Camera in Unity acts as the player's viewpoint into the game world, capturing scenes much like a real camera. It defines the field of view, perspective, and what is visible on the screen. Cameras can transform between world and screen space, control projection settings for depth and perspective, specify rendering settings, and manage culling properties. For comprehensive functionalities, explore Unity's Camera documentation. Unity's Camera Documentation
Properties
Gives the count of all enabled Cameras within the Scene. Unity's Camera.allCamerasCount Documentation
Allows dynamic resolution adjustment for performance optimization. Unity's Camera.allowDynamicResolution Documentation
Controls if the Camera uses High Dynamic Range rendering for enhanced visual details. Unity's Camera.allowHDR Documentation
Enables or disables Multi-Sample Anti-Aliasing for smoother image edges. Unity's Camera.allowMSAA Documentation
Creates anamorphic lens effects by compressing the image in one dimension. Unity's Camera.anamorphism Documentation
Emulates the aperture of a physical camera, impacting light intake and depth of field. Unity's Camera.aperture Documentation
Sets the aspect ratio (width/height) for the Camera. Unity's Camera.aspect Documentation
Sets the background color for the Camera's view. Unity's Camera.backgroundColor Documentation
Determines the clipping level for light entering the camera, affecting edge brightness. Unity's Camera.barrelClipping Documentation
Sets the number of diaphragm blades, affecting the shape of out-of-focus areas. Unity's Camera.bladeCount Documentation
Provides a matrix transforming from camera space to world space. Unity's Camera.cameraToWorldMatrix Documentation
Clears the stencil buffer after lighting pass as an optimization. Unity's Camera.clearStencilAfterLightingPass Documentation
Bit mask for rendering GameObjects on specific Layers. Unity's Camera.cullingMask Documentation
Custom projection matrix for the Camera to adjust rendering. Unity's Camera.cullingMatrix Documentation
Retrieves the currently rendering Camera, useful for effects and scripts during rendering. Unity's Camera.current Documentation
Simulates lens curvature, affecting perspective distortion in the rendered image. Unity's Camera.curvature Documentation
Specifies the Camera's depth in the rendering order. Unity's Camera.depth Documentation
Bit mask to selectively ignore GameObjects when sending events. Unity's Camera.eventMask Documentation
Sets the maximum distance up to which the Camera renders objects in the scene. Unity's Camera.farClipPlane Documentation
Manages the vertical extent of the scene visible at any moment, measured in degrees. Unity's Camera.fieldOfView Documentation
Represents the focal length of the camera lens, affecting the field of view. Unity's Camera.focalLength Documentation
Adjusts the distance to the focus plane, useful for depth of field effects. Unity's Camera.focusDistance Documentation
Forces Camera's view to always render to a texture for advanced image processing. Unity's Camera.forceIntoRenderTexture Documentation
Simulates the ISO setting of a physical camera, affecting image brightness and noise. Unity's Camera.iso Documentation
Defines the maximum logical aperture size for camera simulations, affecting depth of field and light intake. Unity's Camera.kMaxAperture Documentation
Sets the maximum number of aperture blades for detailed bokeh simulation in camera effects. Unity's Camera.kMaxBladeCount Documentation
Specifies the minimum logical aperture size for cameras, constraining physical camera simulations. Unity's Camera.kMinAperture Documentation
Indicates the minimum number of aperture blades for simulating camera bokeh effects. Unity's Camera.kMinBladeCount Documentation
Uses spherical bounds for layer culling computation when enabled. Unity's Camera.layerCullSpherical Documentation
Allows shifting the lens in relation to the sensor, correcting for keystone distortion. Unity's Camera.lensShift Documentation
Accesses the main Camera in the scene, designated by the 'MainCamera' tag. Unity's Camera.main Documentation
Defines the closest distance at which the Camera starts rendering objects. Unity's Camera.nearClipPlane Documentation
Gives a projection matrix without jittering for anti-aliasing. Unity's Camera.nonJitteredProjectionMatrix Documentation
Toggles between Perspective and Orthographic modes for the Camera. Unity's Camera.orthographic Documentation
Defines the size of the view in world units for Orthographic Cameras. Unity's Camera.orthographicSize Documentation
Bit mask override for Scene culling on this Camera. Unity's Camera.overrideSceneCullingMask Documentation
Provides the height in pixels of the Camera's rendering area. Unity's Camera.pixelHeight Documentation
Defines the rectangle, in pixels, that the Camera renders to on the screen. Unity's Camera.pixelRect Documentation
Gives the width in pixels of the Camera's rendering area. Unity's Camera.pixelWidth Documentation
Holds the matrix from multiplying the previous frame's projection matrix by its world-to-camera matrix, useful for effects needing historical comparison. Unity's Camera.previousViewProjectionMatrix Documentation
Offers a custom projection matrix for perspective transformations. Unity's Camera.projectionMatrix Documentation
Specifies the Camera's viewport rectangle, controlling which part of the screen it occupies. Unity's Camera.rect Documentation
Retrieves the height of the Camera's image with the scaling factor applied. Unity's Camera.scaledPixelHeight Documentation
Gets the width of the Camera's image after applying the scaling factor. Unity's Camera.scaledPixelWidth Documentation
Imitates the physical dimensions of the camera sensor, affecting the angle of view. Unity's Camera.sensorSize Documentation
Mimics a camera's shutter speed, influencing exposure and motion blur. Unity's Camera.shutterSpeed Documentation
Custom axis for sorting transparent objects when using Custom Axis mode. Unity's Camera.transparencySortAxis Documentation
Decides whether to use a jittered projection matrix for rendering transparent objects. Unity's Camera.useJitteredProjectionMatrixForTransparentRendering Documentation
Determines if Unity performs occlusion culling for this Camera. Unity's Camera.useOcclusionCulling Documentation
Enables physical camera settings to simulate real camera properties. Unity's Camera.usePhysicalProperties Documentation
Provides the Camera's velocity, useful for motion blur effects. Unity's Camera.velocity Documentation
Allows setting a custom transformation from world space to camera space. Unity's Camera.worldToCameraMatrix Documentation
Methods
Creates a custom projection matrix for oblique near-plane clipping, useful for mirror reflections or water surfaces. Unity's Camera.CalculateObliqueMatrix Documentation
Copies settings from another Camera, including all properties and transformation matrices. Unity's Camera.CopyFrom Documentation
Parameters
other
The source Camera to copy from.
Returns
Calculates the focal length from a given vertical field of view and sensor size. Unity's Camera.FieldOfViewToFocalLength Documentation
Parameters
fieldOfView
The vertical field of view to convert.
sensorSize
The vertical size of the sensor.
Returns
The focal length corresponding to the given field of view.
Converts focal length to vertical field of view for the Camera's sensor size. Unity's Camera.FocalLengthToFieldOfView Documentation
Parameters
focalLength
The focal length to convert.
sensorSize
The vertical size of the sensor.
Returns
The calculated vertical field of view.
Calculates the field of view based on gate fitting, useful for matching physical camera settings. Unity's Camera.GetGateFittedFieldOfView Documentation
Returns
The calculated field of view.
Determines the lens shift required based on gate fitting, aiding in accurate camera simulation. Unity's Camera.GetGateFittedLensShift Documentation
Returns
The required lens shift.
Converts a horizontal field of view to a vertical field of view based on the aspect ratio. Unity's Camera.HorizontalToVerticalFieldOfView Documentation
Parameters
horizontalFieldOfView
The horizontal field of view to convert.
aspectRatio
The aspect ratio of the camera.
Returns
The vertical field of view.
Forces immediate rendering of the scene from this Camera's perspective. Unity's Camera.Render Documentation
Returns
Parameters
shader
replacementTag
Returns
Resets all Camera settings to their defaults, useful for reinitializing camera properties. Unity's Camera.Reset Documentation
Returns
Resets the Camera's aspect ratio to the screen's aspect ratio, undoing any custom aspect ratio settings. Unity's Camera.ResetAspect Documentation
Returns
Resets the Camera's culling matrix to the default, useful for undoing custom culling adjustments. Unity's Camera.ResetCullingMatrix Documentation
Returns
Reverts the Camera's projection matrix to default, useful for standard perspective restoration. Unity's Camera.ResetProjectionMatrix Documentation
Returns
Removes any replacement shader from the Camera, returning to standard rendering. Unity's Camera.ResetReplacementShader Documentation
Returns
Reverts the Camera's transparency sort settings to the default state. Unity's Camera.ResetTransparencySortSettings Documentation
Returns
Resets the Camera's world-to-camera matrix to the identity matrix, clearing any transformations. Unity's Camera.ResetWorldToCameraMatrix Documentation
Returns
Creates a ray from the Camera through a screen point, primarily for object selection via raycasting. Unity's Camera.ScreenPointToRay Documentation
Creates a ray from the Camera through a screen point, primarily for object selection via raycasting. Unity's Camera.ScreenPointToRay Documentation
Transforms a point from screen space to normalized viewport space. Unity's Camera.ScreenToViewportPoint Documentation
Converts a point from screen space into world space for this Camera, useful for interaction with game objects. Unity's Camera.ScreenToWorldPoint Documentation
Parameters
shader
replacementTag
Returns
Converts a vertical field of view to a horizontal field of view based on the aspect ratio. Unity's Camera.VerticalToHorizontalFieldOfView Documentation
Parameters
verticalFieldOfView
The vertical field of view to convert.
aspectRatio
The aspect ratio of the camera.
Returns
The horizontal field of view.
Converts a point from normalized viewport space to screen space. Unity's Camera.ViewportToScreenPoint Documentation
Transforms a world space point to screen space, allowing UI alignment or visibility checks. Unity's Camera.WorldToScreenPoint Documentation
Updated 9 days ago