Class CinemachineExtension
Base class for a Cinemachine Virtual Camera extension module. Hooks into the Cinemachine Pipeline.
Inheritance
Namespace: Cinemachine
Syntax
[DocumentationSorting(DocumentationSortingAttribute.Level.API)]
public abstract class CinemachineExtension : MonoBehaviour
Fields
Epsilon
Useful constant for very small floats
Declaration
protected const float Epsilon = 0.0001F
Field Value
Type | Description |
---|---|
System.Single |
Properties
VirtualCamera
Get the associated CinemachineVirtualCameraBase
Declaration
public CinemachineVirtualCameraBase VirtualCamera { get; }
Property Value
Type | Description |
---|---|
CinemachineVirtualCameraBase |
Methods
Awake()
Connect to virtual camera pipeline. Override implementations must call this base implementation
Declaration
protected virtual void Awake()
ConnectToVcam(Boolean)
Connect to virtual camera. Implementation must be safe to be called redundantly. Override implementations must call this base implementation
Declaration
protected virtual void ConnectToVcam(bool connect)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | connect | True if connectinf, false if disconnecting |
GetAllExtraStates<T>()
Ineffeicient method to get all extra state infor for all vcams. Intended for Editor use only, not runtime!
Declaration
protected List<T> GetAllExtraStates<T>()
where T : class, new()
Returns
Type | Description |
---|---|
System.Collections.Generic.List<T> |
Type Parameters
Name | Description |
---|---|
T |
GetExtraState<T>(ICinemachineCamera)
Because extensions can be placed on manager cams and will in that case be called for all the vcam children, vcam-specific state information should be stored here. Just define a class to hold your state info and use it exclusively when calling this.
Declaration
protected T GetExtraState<T>(ICinemachineCamera vcam)
where T : class, new()
Parameters
Type | Name | Description |
---|---|---|
ICinemachineCamera | vcam |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
InvokePostPipelineStageCallback(CinemachineVirtualCameraBase, CinemachineCore.Stage, ref CameraState, Single)
Legacy support. This is only here to avoid changing the API to make PostPipelineStageCallback() public
Declaration
public void InvokePostPipelineStageCallback(CinemachineVirtualCameraBase vcam, CinemachineCore.Stage stage, ref CameraState state, float deltaTime)
Parameters
Type | Name | Description |
---|---|---|
CinemachineVirtualCameraBase | vcam | |
CinemachineCore.Stage | stage | |
CameraState | state | |
System.Single | deltaTime |
OnDestroy()
Disconnect from virtual camera pipeline. Override implementations must call this base implementation
Declaration
protected virtual void OnDestroy()
OnTargetObjectWarped(Transform, Vector3)
This is called to notify the extension that a target got warped, so that the extension can update its internal state to make the camera also warp seamlessy. Base class implementation does nothing.
Declaration
public virtual void OnTargetObjectWarped(Transform target, Vector3 positionDelta)
Parameters
Type | Name | Description |
---|---|---|
Transform | target | The object that was warped |
Vector3 | positionDelta | The amount the target's position changed |
OnTransitionFromCamera(ICinemachineCamera, Vector3, Single)
Notification that this virtual camera is going live. Base class implementation must be called by any overridden method.
Declaration
public virtual bool OnTransitionFromCamera(ICinemachineCamera fromCam, Vector3 worldUp, float deltaTime)
Parameters
Type | Name | Description |
---|---|---|
ICinemachineCamera | fromCam | The camera being deactivated. May be null. |
Vector3 | worldUp | Default world Up, set by the CinemachineBrain |
System.Single | deltaTime | Delta time for time-based effects (ignore if less than or equal to 0) |
Returns
Type | Description |
---|---|
System.Boolean | True to request a vcam update of internal state |
PostPipelineStageCallback(CinemachineVirtualCameraBase, CinemachineCore.Stage, ref CameraState, Single)
This callback will be called after the virtual camera has implemented each stage in the pipeline. This method may modify the referenced state. If deltaTime less than 0, reset all state info and perform no damping.
Declaration
protected abstract void PostPipelineStageCallback(CinemachineVirtualCameraBase vcam, CinemachineCore.Stage stage, ref CameraState state, float deltaTime)
Parameters
Type | Name | Description |
---|---|---|
CinemachineVirtualCameraBase | vcam | |
CinemachineCore.Stage | stage | |
CameraState | state | |
System.Single | deltaTime |