Articles/Programming
Debugging Intermediate

GEditor & Standalone Editor

Why editor compilation guards alone do not make GEditor safe to use in standalone mode, and where a null check helps.

Programming Tools C++ Intermediate Debugging
Articles C++Plugin Programming Intermediate C++ Plugin

Be careful when using #if WITH_EDITOR

#if WITH_EDITOR 
    GEditor->SelectNone(true, true, false); 
#endif

⚠️ This code crashes ⚠️ in Standalone Editor because:

  • #if WITH_EDITOR returns true

  • GEditor doesn’t exist in editor standalone

It doesn’t hurt to add a nullptr check