C4 Engine Terathon Software C4 Engine API Documentation

• Controller System

API Links
Developer Links

Controller::Preprocess

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

virtual void Preprocess(void);

Description
The Preprocess 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 Preprocess 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 GetManipulator 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::Preprocess