This component is added to Camera Objects by the PerCameraMeshDrawer class.
It is used to get a callback notification when a particular condition occurs.

Detailed Description

Each registered object does not need to poll the camera object state every cycle.
Instead, it is checked once, and only if the condition is true, are the callbacks invoked. Default behavior will invoke the callback function for all registered objects during update, if the camera's transform has changed. Derive from this class, and override IsCallbackNeeded to change this behavior.

Public Member Functions

delegate void CameraCallbackSignture (Camera camera, Matrix4x4 view, Matrix4x4 projection)
 The delegate defines the signature of the callback functions used when registering object with the ObjectCallbackCamera class.
 
void InvokeCallbackForAllRegisteredObjects ()
 Function to manually invoke the all stored callback functions. Internally called during OnEnable, and, when IsCallbackNeeded returns true, it is called during Update. Callbacks are stored, and invoked, "unordered".
 
void InvokeCallbackForObject (MonoBehaviour target)
 Function to manually invoke Callback for a particular object. Searches though all recorded callback for the one that has the MonoBehaviour specified in the Target member. If no such callback has been previously registered, this function will invoke nothing.
 
virtual bool IsCallbackNeeded ()
 Detects change in camera transform and returns true if change detected. Override to change/add behavior.
 
delegate void UpdateCallback ()
 Delegate defines the signature required for callback functions.
 

Static Public Member Functions

static void RegisterObjectWithCallbackCamera (CameraCallbackSignture function, Camera cam)
 The function passed in will be called every time the ObjectCallbackCamera determines a notification is required.

 
static void RegisterObjectWithCallbackCamera< TypeOfCallbackCamera > (CameraCallbackSignture function, Camera cam)
 The function passed in will be called every time the CallbackCamera determines a notification is required.
If the camera being registering with, does not have an existing TypeOfCallbackCamera component, one will be created and added to the camera. The base class version, ObjectCallbackCamera, will invoke the callback when the transform of the camera changes. You may override the IsCallbackNeeded to change this functionality, but will need to pass your derived class into the type parameter for this registration function.
 
static void UnRegisterObjectWithCallbackCamera (CameraCallbackSignture function, Camera cam)
 Removes the function from the callback set of the provided camera's CallbackCamera component
 
static void UnRegisterObjectWithCallbackCamera< TypeOfCallbackCamera > (CameraCallbackSignture function, Camera cam)
 Removes the function from the callback set of the provided camera. The callback set the function is removed from, is found in the TypeOfCallbackCamera component attached to the camera. If so such component exists (because it was not registered), this function will have no effect.
 

Public Attributes

List< CameraCallbackSignturecallbacksSet
 Stores the set of callback functions registered with this camera. Objects/callback pairs are removed when unregistered.
 
bool forceNextCallback
 When this value is true, the Callback will be invoked at the next opportunity.
 

Static Public Attributes

static List< UpdateCallbackregisteredUpdateDelegates
 All updates that have been registered, are stored in this list.
 
static bool saveNewCallbackCameraComponentsInScene
 When false, as it is by default, the Callback Camera components added to camera objects during registration will NOT be saved to the scene.
Even when saved to the scene, the list of callback is not serialized- object will still need to register callback with this class, during their initialization. Not saving the component is OK because registering a callback with a camera will automatically add the component if necessary. Recommended setting this to true for debugging purposes only.
 

Protected Member Functions

virtual void OnDisable ()
 OnDisable this class will unregister with EditorApplication.update if in the unity editor. The previously registered callbacks remain stored.
 
virtual void OnEnable ()
 OnEnable this class will register with EditorApplication.update if in the unity editor, and will call InvokeCallbackForAllRegisteredObjects.
 
virtual void Update ()
 If IsCallbackNeeded returns true, will call InvokeCallbackForAllRegisteredObjects.
 

Protected Attributes

Camera thisCamera
 Internal reference to the required Camera component
 
+ Inheritance diagram for CallbackCamera:
+ Collaboration diagram for CallbackCamera: