C4 Engine
C4 Engine API Documentation

Controller::PreprocessController

Defined in:  C4Controller.h
Performs any preprocessing that a controller needs to do before being used in a world.
Prototype

virtual void PreprocessController(void);

Description
The PreprocessController function is called when the node to which a controller is attached is preprocessed. A controller subclass may perform whatever action is necessary to initialize the controller.

Any override of the PreprocessController function should always call the base class counterpart, or the controller will not function correctly.
Special Considerations
It is often the case that a controller will not want to perform certain initialization while it is being preprocessed inside the World Editor, but only when a game is actually being played. A controller can determine whether it is running inside the World Editor by calling the GetDirector function for its target node. If the return value is not nullptr, then the controller is running inside the World Editor. If the return value is nullptr, then the world to which the target node belongs is actually being played.
See Also

Node::PreprocessNode