Cinemachine
CinemachineVirtualCameraBase Class |
Base class for a Monobehaviour that represents a Virtual Camera within the Unity scene.
This is intended to be attached to an empty Transform GameObject.
Inherited classes can be either standalone virtual cameras such
as CinemachineVirtualCamera, or meta-cameras such as
CinemachineClearShot or CinemachineFreeLook.
A CinemachineVirtualCameraBase exposes a Priority property. When the behaviour is
enabled in the game, the Virtual Camera is automatically placed in a queue
maintained by the static CinemachineCore singleton.
The queue is sorted by priority. When a Unity camera is equipped with a
CinemachineBrain behaviour, the brain will choose the camera
at the head of the queue. If you have multiple Unity cameras with CinemachineBrain
behaviours (say in a split-screen context), then you can filter the queue by
setting the culling flags on the virtual cameras. The culling mask of the
Unity Camera will then act as a filter for the brain. Apart from this,
there is nothing that prevents a virtual camera from controlling multiple
Unity cameras simultaneously.
Inheritance Hierarchy
SystemObject Object
Component
Behaviour
MonoBehaviour
CinemachineCinemachineVirtualCameraBase
More...
Component
Behaviour
MonoBehaviour
CinemachineCinemachineVirtualCameraBase
More...
Namespace: Cinemachine
Assembly: Cinemachine (in Cinemachine.dll) Version: 2.0.0.0 (2.0.0.0)
Syntax
[SaveDuringPlayAttribute] public abstract class CinemachineVirtualCameraBase : MonoBehaviour, ICinemachineCamera
Cinemachine.CinemachineVirtualCameraBase = function(); Type.createClass( 'Cinemachine.CinemachineVirtualCameraBase', UnityEngine.MonoBehaviour, Cinemachine.ICinemachineCamera);
The CinemachineVirtualCameraBase type exposes the following members.
Constructors
Name | Description | |
---|---|---|
CinemachineVirtualCameraBase |
Properties
Name | Description | |
---|---|---|
Description | Gets a brief debug description of this virtual camera, for use when displayiong debug info | |
Follow | Get the Follow target for the Body component in the CinemachinePipeline. | |
LiveChildOrSelf | Just returns self. | |
LookAt | Get the LookAt target for the Aim component in the CinemachinePipeline. | |
Name | Get the name of the Virtual Camera. Base implementation
returns the owner GameObject's name. | |
ParentCamera | Support for meta-virtual-cameras. This is the situation where a
virtual camera is in fact the public face of a private army of virtual cameras, which
it manages on its own. This method gets the VirtualCamera owner, if any.
Private armies are implemented as Transform children of the parent vcam. | |
PreviousStateIsValid | Set this to force the next update to ignore deltaTime and reset itself | |
Priority | Get the Priority of the virtual camera. This determines its placement
in the CinemachineCore's queue of eligible shots. | |
State | The CameraState object holds all of the information
necessary to position the Unity camera. It is the output of this class. | |
ValidatingStreamVersion | Version that was last streamed, for upgrading legacy | |
VirtualCameraGameObject | The GameObject owner of the Virtual Camera behaviour. |
Methods
Name | Description | |
---|---|---|
AddPostPipelineStageHook |
A delegate to hook into the state calculation pipeline.
This will be called after each pipeline stage, to allow others to hook into the pipeline.
See CinemachineCore.Stage.
| |
InvokePostPipelineStageCallback |
Invokes the PostPipelineStageDelegate for this camera, and up the hierarchy for all
parent cameras (if any).
| |
IsLiveChild | Check whether the vcam a live child of this camera.
This base class implementation always returns false. | |
MoveToTopOfPrioritySubqueue | When multiple virtual cameras have the highest priority, there is
sometimes the need to push one to the top, making it the current Live camera if
it shares the highest priority in the queue with its peers.
This happens automatically when a
new vcam is enabled: the most recent one goes to the top of the priority subqueue.
Use this method to push a vcam to the top of its priority peers.
If it and its peers share the highest priority, then this vcam will become Live. | |
OnDestroy | Base class implementation removes the virtual camera from the priority queue. | |
OnDisable | Base class implementation makes sure the priority queue remains up-to-date. | |
OnEnable | Base class implementation adds the virtual camera from the priority queue. | |
OnTransformParentChanged | Base class implementation makes sure the priority queue remains up-to-date. | |
OnTransitionFromCamera | Notification that this virtual camera is going live.
Base class implementationmust be called by any overridden method. | |
OnValidate | Enforce bounds for fields, when changed in inspector.
Call base class implementation at the beginning of overridden method.
After base method is called, ValidatingStreamVersion will be valid. | |
PreUpdateChildCameras |
This is called prior to the updating of the vcam's child cameras,
in order to allow the parent to prepare its children.
If the children are updating on FixedUpdate, then this will not necessarily be called
prior to every FixedUpdate, but it might be called on LateUpdate instead.
Base class implementation does nothing.
| |
RemovePostPipelineStageHook | Remove a Pipeline stage hook callback. | |
ResolveFollow | Returns this vcam's Follow target, or if that is null, will retrun
the parent vcam's Follow target. | |
ResolveLookAt | Returns this vcam's LookAt target, or if that is null, will retrun
the parent vcam's LookAt target. | |
Start | Base class implementation does nothing. | |
Update | Base class implementation makes sure the priority queue remains up-to-date. | |
UpdateCameraState | Called by CinemachineCore at designated update time
so the vcam can position itself and track its targets.
Do not call this method. Let the framework do it at the appropriate time |
Fields
Name | Description | |
---|---|---|
CinemachineGUIDebuggerCallback | This is deprecated. It is here to support the soon-to-be-removed
Cinemachine Debugger in the Editor. | |
m_ExcludedPropertiesInInspector | Inspector control - Use for hiding sections of the Inspector UI. | |
m_LockStageInInspector | Inspector control - Use for enabling sections of the Inspector UI. | |
m_Priority | The priority will determine which camera becomes active based on the
state of other cameras and this camera. Higher numbers have greater priority.
| |
OnPostPipelineStage |
A delegate to hook into the state calculation pipeline.
Implementaion must be sure to call this after each pipeline stage, to allow
other services to hook into the pipeline.
See CinemachineCore.Stage.
|
See Also
Reference
Inheritance Hierarchy
SystemObject
Object
Component
Behaviour
MonoBehaviour
CinemachineCinemachineVirtualCameraBase
CinemachineCinemachineBlendListCamera
CinemachineCinemachineClearShot
CinemachineCinemachineExternalCamera
CinemachineCinemachineFreeLook
CinemachineCinemachineMixingCamera
CinemachineCinemachineStateDrivenCamera
CinemachineCinemachineVirtualCamera
Object
Component
Behaviour
MonoBehaviour
CinemachineCinemachineVirtualCameraBase
CinemachineCinemachineBlendListCamera
CinemachineCinemachineClearShot
CinemachineCinemachineExternalCamera
CinemachineCinemachineFreeLook
CinemachineCinemachineMixingCamera
CinemachineCinemachineStateDrivenCamera
CinemachineCinemachineVirtualCamera