Unity.Manual.Scripts
User Manual:
Open the PDF directly: View PDF
.
Page Count: 2723
Leave feedback
Description
A class containing methods to assist with accessibility for users with di erent vision capabilities.
Static Methods
GetColorBlindSafePalette
Gets a palette of colors that should be distinguishable for normal vision,
deuteranopia, protanopia, and tritanopia.
Leave feedback
Description
Unity Ads.
Static Properties
debugMode
Controls the amount of logging output from the advertisement system.
gameId
Returns the game identi er for the current platform.
isInitialized
Returns whether the advertisement system is initialized successfully.
isShowing
Returns whether an advertisement is currently being shown.
isSupported
Returns if the current platform is supported by the advertisement system.
testMode
Returns whether the testing mode is enabled.
version
Returns the current Unity Ads version.
Static Methods
GetPlacementState
Returns the placement state.
Initialize
Manually initializes the advertisement system. Normally this is done from editor, and
you should only call this method if you are using UnityAds with automatic initialization
disabled.
IsReady
Returns whether an advertisement is ready to be shown. Placements are con gured per
game in the UnityAds admin site, where you can also set your default placement.
SetMetaData
Sets various metadata for Unity Ads.
Show
Show an advertisement in your project.
Leave feedback
Obsolete
Description
Player debug message level.
Leave feedback
Description
Class for sending various metadata to UnityAds.
Properties
category
Metadata category.
Values
Public Methods
Get
Set
Sets new metadata elds.
Leave feedback
Description
Collection of options that can be passed to Advertisements.Show to modify advertisement behaviour.
Properties
gamerSid
Add a string to specify an identi er for a speci c user in the game.
resultCallback
Callback to recieve the result of the advertisement.
Leave feedback
Description
Various states that Unity Ads placements can be in.
Properties
Ready
Placement is ready to be shown an advertisement from.
NotAvailable
Placement is not available.
Disabled
Placement has been disabled.
Waiting
Placement is waiting to be ready.
NoFill
Placement has no advertisements to show.
Leave feedback
Description
ShowResult is passed to ShowOptions.resultCallback after the advertisement has completed.
Properties
Failed
Indicates that the advertisement failed to complete.
Skipped
Indicates that the advertisement was skipped.
Finished
Indicates that the advertisement completed successfully.
Leave feedback
Description
Singleton class to access the baked NavMesh.
The NavMesh is a class can be used to do spatial queries, like path nding and walkability tests, set the path nding
cost for speci c area types, and to tweak global behavior of path nding and avoidance.
In order to use the spatial queries, you need to rst bake NavMesh for your Scene.
See also:
• Building a NavMesh – for more information on how to setup and bake NavMesh
• Areas and Costs – to learn how to use di erent Area types.
• NavMeshAgent – to learn how to control and move NavMesh Agents.
• NavMeshObstacle – to learn how to control NavMesh Obstacles using scripting.
• O MeshLink – to learn how to control O -Mesh Links using scripting.
Static Properties
AllAreas
Area mask constant that includes all NavMesh areas.
avoidancePredictionTime
Describes how far in the future the agents predict collisions for avoidance.
onPreUpdate
Set a function to be called before the NavMesh is updated during the frame
update execution.
path ndingIterationsPerFrame
The maximum amount of nodes processed each frame in the asynchronous
path nding process.
Static Methods
AddLink
Adds a link to the NavMesh. The link is described by the NavMeshLinkData struct.
AddNavMeshData
Adds the speci ed NavMeshData to the game.
CalculatePath
Calculate a path between two points and store the resulting path.
CalculateTriangulation
Calculates triangulation of the current navmesh.
CreateSettings
Creates and returns a new entry of NavMesh build settings available for runtime
NavMesh building.
FindClosestEdge
Locate the closest NavMesh edge from a point on the NavMesh.
GetAreaCost
Gets the cost for path nding over geometry of the area type.
GetAreaFromName
Returns the area index for a named NavMesh area type.
GetSettingsByID
Returns an existing entry of NavMesh build settings.
GetSettingsByIndex
Returns an existing entry of NavMesh build settings by its ordered index.
GetSettingsCount
Returns the number of registered NavMesh build settings.
GetSettingsNameFromID
Returns the name associated with the NavMesh build settings matching the
provided agent type ID.
Raycast
Trace a line between two points on the NavMesh.
RemoveAllNavMeshData
Removes all NavMesh surfaces and links from the game.
RemoveLink
Removes a link from the NavMesh.
RemoveNavMeshData
Removes the speci ed NavMeshDataInstance from the game, making it
unavailable for agents and queries.
RemoveSettings
Removes the build settings matching the agent type ID.
SamplePosition
Finds the closest point on NavMesh within speci ed range.
SetAreaCost
Sets the cost for nding path over geometry of the area type on all agents.
Delegates
OnNavMeshPreUpdate
A delegate which can be used to register callback methods to be invoked before the
NavMesh system updates.
Leave feedback
Description
Navigation mesh agent.
This component is attached to a mobile character in the game to allow it to navigate the Scene using the
NavMesh. See the Navigation section of the manual for further details.
Properties
acceleration
The maximum acceleration of an agent as it follows a path, given in units / sec^2.
agentTypeID
The type ID for the agent.
angularSpeed
Maximum turning speed in (deg/s) while following a path.
areaMask
Speci es which NavMesh areas are passable. Changing areaMask will make the
path stale (see isPathStale).
autoBraking
Should the agent brake automatically to avoid overshooting the destination
point?
autoRepath
Should the agent attempt to acquire a new path if the existing path becomes
invalid?
autoTraverseO MeshLink
Should the agent move across O MeshLinks automatically?
avoidancePriority
The avoidance priority level.
baseO set
The relative vertical displacement of the owning GameObject.
currentO MeshLinkData
The current O MeshLinkData.
desiredVelocity
The desired velocity of the agent including any potential contribution from
avoidance. (Read Only)
destination
Gets or attempts to set the destination of the agent in world-space units.
hasPath
Does the agent currently have a path? (Read Only)
height
The height of the agent for purposes of passing under obstacles, etc.
isOnNavMesh
Is the agent currently bound to the navmesh? (Read Only)
isOnO MeshLink
Is the agent currently positioned on an O MeshLink? (Read Only)
isPathStale
Is the current path stale. (Read Only)
isStopped
This property holds the stop or resume condition of the NavMesh agent.
navMeshOwner
Returns the owning object of the NavMesh the agent is currently placed on (Read
Only).
nextO MeshLinkData
The next O MeshLinkData on the current path.
nextPosition
Gets or sets the simulation position of the navmesh agent.
obstacleAvoidanceType
The level of quality of avoidance.
path
Property to get and set the current path.
pathPending
Is a path in the process of being computed but not yet ready? (Read Only)
pathStatus
The status of the current path (complete, partial or invalid).
radius
The avoidance radius for the agent.
remainingDistance
The distance between the agent's position and the destination on the current
path. (Read Only)
speed
Maximum movement speed when following a path.
steeringTarget
Get the current steering target along the path. (Read Only)
stoppingDistance
Stop within this distance from the target position.
updatePosition
Gets or sets whether the transform position is synchronized with the simulated
agent position. The default value is true.
updateRotation
Should the agent update the transform orientation?
updateUpAxis
Allows you to specify whether the agent should be aligned to the up-axis of the
NavMesh or link that it is placed on.
velocity
Access the current velocity of the NavMeshAgent component, or set a velocity to
control the agent manually.
Public Methods
ActivateCurrentO MeshLink
Enables or disables the current o -mesh link.
CalculatePath
Calculate a path to a speci ed point and store the resulting path.
CompleteO MeshLink
Completes the movement on the current O MeshLink.
FindClosestEdge
Locate the closest NavMesh edge.
GetAreaCost
Gets the cost for path calculation when crossing area of a particular type.
Move
Apply relative movement to current position.
Raycast
Trace a straight path towards a target postion in the NavMesh without moving
the agent.
ResetPath
Clears the current path.
SamplePathPosition
Sample a position along the current path.
SetAreaCost
Sets the cost for traversing over areas of the area type.
SetDestination
Sets or updates the destination thus triggering the calculation for a new path.
SetPath
Assign a new path to this agent.
Warp
Warps agent to the provided position.
Inherited Members
Properties
enabled
Enabled Behaviours are Updated, disabled Behaviours are not.
isActiveAndEnabled
Has the Behaviour had active and enabled called?
gameObject
The game object this component is attached to. A component is always attached to a
game object.
tag
The tag of this game object.
transform
The Transform attached to this GameObject.
hideFlags
Should the object be hidden, saved with the Scene or modi able by the user?
name
The name of the object.
Public Methods
BroadcastMessage
Calls the method named methodName on every MonoBehaviour in this game
object or any of its children.
CompareTag
Is this game object tagged with tag ?
GetComponent
Returns the component of Type type if the game object has one attached, null if
it doesn't.
GetComponentInChildren
Returns the component of Type type in the GameObject or any of its children
using depth rst search.
GetComponentInParent
Returns the component of Type type in the GameObject or any of its parents.
GetComponents
Returns all components of Type type in the GameObject.
GetComponentsInChildren
Returns all components of Type type in the GameObject or any of its children.
GetComponentsInParent
Returns all components of Type type in the GameObject or any of its parents.
SendMessage
Calls the method named methodName on every MonoBehaviour in this game
object.
SendMessageUpwards
Calls the method named methodName on every MonoBehaviour in this game
object and on every ancestor of the behaviour.
GetInstanceID
Returns the instance id of the object.
ToString
Returns the name of the GameObject.
Static Methods
Destroy
Removes a gameobject, component or asset.
DestroyImmediate
Destroys the object obj immediately. You are strongly recommended to use Destroy
instead.
DontDestroyOnLoad
Makes the object target not be destroyed automatically when loading a new Scene.
FindObjectOfType
Returns the rst active loaded object of Type type.
FindObjectsOfType
Returns a list of all active loaded objects of Type type.
Instantiate
Clones the object original and returns the clone.
Operators
bool
Does the object exist?
operator !=
Compares if two objects refer to a di erent object.
operator ==
Compares two object references to see if they refer to the same object.
Leave feedback
Description
Specify which of the temporary data generated while building the NavMesh should be retained in memory after
the process has completed.
It is possible to collect and display in the Editor the intermediate data used in the process of building the
navigation mesh using the NavMeshBuilder. This can help with diagnosing those situations when the resulting
NavMesh isn’t of the expected shape.
Input Geometry, Regions, Polygonal Mesh Detail and Raw Contours shown after building the NavMesh with debug
options
The process for computing a NavMesh comprises of several sequential steps:
i. decomposing the Scene's terrain and meshes into triangles;
ii. rasterizing the input triangles into a 3D voxel representation and nding ledges;
iii. partitioning the voxels lying at the surface into simpler horizontal regions;
iv. nding a tight- tting contour for each of these regions;
v. simplifying the contours into polygonal shapes;
vi. creating a mesh of convex polygons based on all the contours combined;
vii. re ning the polygonal mesh into a triangulated version that approximates better the Scene's original
geometry.
Through the use of the debug functionality the results from each stage can be captured and displayed separately,
whereas normally they would get discarded when the NavMesh construction is completed.
Depending on the Scene composition this debug data can be considerably large in size. It is stored in memory in a
compressed manner but gets further expanded when being displayed.
Notes:
1. Unity does not save Debug visualizations - they are only available during the session in which Unity is building
the NavMesh.
2. Debug data is neither displayed nor collected for NavMeshes that are statically baked with the legacy system,
nor for any patches recomputed locally due to the presence of NavMesh Obstacles.
See Also: NavMeshBuildSettings, NavMeshBuilder.BuildNavMeshData, NavMeshEditorHelpers.DrawBuildDebug.
Properties
ags
Specify which types of debug data to collect when building the NavMesh.
Leave feedback
Description
Navigation mesh builder interface.
Note: There are two classes with the name NavMeshBuilder. They are declared in two di erent namespaces:
UnityEngine.AI and UnityEditor.AI. Their methods are all listed together on this page. The namespace is
indicated in parentheses next to each method.
Static Properties
isRunning
Returns true if an asynchronous build is still running. (UnityEditor)
Static Methods
BuildNavMesh
Build the Navmesh. (UnityEditor)
BuildNavMeshAsync
Build the Navmesh Asyncronously. (UnityEditor)
BuildNavMeshData
Builds a NavMesh data object from the provided input sources.
(UnityEngine)
BuildNavMeshForMultipleScenes
Builds the combined navmesh for the contents of multiple Scenes.
(UnityEditor)
Cancel
Cancel Navmesh construction. (UnityEditor) See Also:
NavMeshBuilder.BuildNavMeshAsync
ClearAllNavMeshes
Clear all Navmeshes. (UnityEditor)
CollectSources
For convenience, you can create a list of build sources directly from the
current geometry. (UnityEngine)
CollectSourcesInStage
Creates a list of build sources directly from the current geometry in the
speci ed editor stage. (UnityEditor)
UpdateNavMeshData
Incrementally updates the NavMeshData based on the sources.
(UnityEngine)
UpdateNavMeshDataAsync
Asynchronously and incrementally updates the NavMeshData based on
the sources. (UnityEngine)
Leave feedback
Description
The NavMesh build markup allows you to control how certain objects are treated during the NavMesh build
process, speci cally when collecting sources for building.
You can override the area type or specify that certain objects should be excluded from collected sources. The
markup is applied hierarchically. See Also: NavMeshBuilder.CollectSources.
Properties
area
The area type to use when override area is enabled.
ignoreFromBuild
Use this to specify whether the GameObject and its children should be ignored.
overrideArea
Use this to specify whether the area type of the GameObject and its children should be
overridden by the area type speci ed in this struct.
root
Use this to specify which GameObject (including the GameObject’s children) the markup
should be applied to.
Leave feedback
Description
The NavMeshBuildSettings struct allows you to specify a collection of settings which describe the dimensions and
limitations of a particular agent type.
You might want to de ne multiple NavMeshBuildSettings if your game involves characters with large di erences
in height, width or climbing ability.
You can also use this struct to control the precision and granularity of the build process, by setting the voxel and
tile sizes. Some of the values are coupled, meaning there are constraints on the values based on other values. For
example, it’s not valid for agentClimb to be larger than agentHeight. To help diagnose violations of these rules, a
special method ValidationReport can be evaluated.
Properties
agentClimb
The maximum vertical step size an agent can take.
agentHeight
The height of the agent for baking in world units.
agentRadius
The radius of the agent for baking in world units.
agentSlope
The maximum slope angle which is walkable (angle in degrees).
agentTypeID
The agent type ID the NavMesh will be baked for.
debug
Options for collecting debug data during the build process.
minRegionArea
The approximate minimum area of individual NavMesh regions.
overrideTileSize
Enables overriding the default tile size. See Also: tileSize.
overrideVoxelSize
Enables overriding the default voxel size. See Also: voxelSize.
tileSize
Sets the tile size in voxel units.
voxelSize
Sets the voxel size in world length units.
Public Methods
ValidationReport
Validates the properties of NavMeshBuildSettings.
Leave feedback
Description
The input to the NavMesh builder is a list of NavMesh build sources.
Their shape can be one of the following: mesh, terrain, box, sphere, or capsule. Each of them is described by a
NavMeshBuildSource struct.
You can specify a build source by lling a NavMeshBuildSource struct and adding that to the list of sources that
are passed to the bake function. Alternatively, you can use the collect API to quickly create NavMesh build sources
from available render meshes or physics colliders. See NavMeshBuilder.CollectSources.
If you use this function at runtime, any meshes with read/write access disabled will not be processed or included
in the nal NavMesh. See Mesh.isReadable.
using UnityEngine;
using UnityEngine.AI;
public class Example : MonoBehaviour
{
// Make a build source for a box in local space
public NavMeshBuildSource BoxSource10x10()
{
var src = new NavMeshBuildSource();
src.transform = transform.localToWorldMatrix;
src.shape = NavMeshBuildSourceShape.Box;
src.size = new Vector3(10.0f, 0.1f, 10.0f);
return src;
}
}
Properties
area
Describes the area type of the NavMesh surface for this object.
component
Points to the owning component - if available, otherwise null.
shape
The type of the shape this source describes. See Also: NavMeshBuildSourceShape.
size
Describes the dimensions of the shape.
sourceObject
Describes the object referenced for Mesh and Terrain types of input sources.
transform
Describes the local to world transformation matrix of the build source. That is, position
and orientation and scale of the shape.
Leave feedback
Description
Contains and represents NavMesh data.
An object of this class can be used for creating instances of NavMeshes. See NavMesh.AddNavMeshData. The
contained NavMesh can be built and updated using the build API. See NavMeshBuilder and methods therein.
Properties
position
Gets or sets the world space position of the NavMesh data.
rotation
Gets or sets the orientation of the NavMesh data.
sourceBounds
Returns the bounding volume of the input geometry used to build this NavMesh (Read
Only).
Constructors
NavMeshData
Constructs a new object for representing a NavMesh for the default agent type.
Inherited Members
Properties
hideFlags
Should the object be hidden, saved with the Scene or modi able by the user?
name
The name of the object.
Public Methods
GetInstanceID
Returns the instance id of the object.
ToString
Returns the name of the GameObject.
Static Methods
Destroy
Removes a gameobject, component or asset.
DestroyImmediate
Destroys the object obj immediately. You are strongly recommended to use Destroy
instead.
DontDestroyOnLoad
Makes the object target not be destroyed automatically when loading a new Scene.
FindObjectOfType
Returns the rst active loaded object of Type type.
FindObjectsOfType
Returns a list of all active loaded objects of Type type.
Instantiate
Clones the object original and returns the clone.
Operators
bool
Does the object exist?
operator !=
Compares if two objects refer to a di erent object.
operator ==
Compares two object references to see if they refer to the same object.
Leave feedback
Description
The instance is returned when adding NavMesh data.
A valid NavMesh data instance is available to the navigation system. This means you can calculate paths etc. using
that instance. You also need the instance if you want to remove the NavMesh data at a later time.
See Also: Remove, NavMesh.AddNavMeshData, NavMesh.RemoveNavMeshData.
Properties
owner
Get or set the owning Object.
valid
True if the NavMesh data is added to the navigation system - otherwise false (Read Only).
Public Methods
Remove
Removes this instance from the NavMesh system.
Leave feedback
Description
Result information for NavMesh queries.
Properties
distance
Distance to the point of hit.
hit
Flag set when hit.
mask
Mask specifying NavMesh area at point of hit.
normal
Normal at the point of hit.
position
Position of hit.
Leave feedback
Description
Used for runtime manipulation of links connecting polygons of the NavMesh.
A typical use case is to connect di erent navigation meshes. The link is described by the NavMeshLinkData struct.
The NavMesh Link is the scripting equivalent of the class-O MeshLink component – but allows for wide links as
opposed to just points.
Properties
agentTypeID
Speci es which agent type this link is available for.
area
Area type of the link.
bidirectional
If true, the link can be traversed in both directions, otherwise only from start to end
position.
costModi er
If positive, overrides the path nder cost to traverse the link.
endPosition
End position of the link.
startPosition
Start position of the link.
width
If positive, the link will be rectangle aligned along the line from start to end.
Leave feedback
Description
An instance representing a link available for path nding.
It can also be used for removing NavMesh links from the navigation system.
Properties
owner
Get or set the owning Object.
valid
True if the NavMesh link is added to the navigation system - otherwise false (Read Only).
Public Methods
Remove
Removes this instance from the game.
Leave feedback
Description
An obstacle for NavMeshAgents to avoid.
A NavMeshObstacle is cylindrical in shape and can move around the surface of the NavMesh with a speci ed
velocity. By default, the obstacle will only a ect the agent's avoidance behaviour rather than the path nding. This
means that the agent will ignore the obstacle when plotting a path but will sidestep around it while moving along
the path. If carving is enabled, the obstacle will create a temporary "hole" in the NavMesh. The hole will be
recognised by the path nding, so paths will be plotted to avoid the obstacle. This means that if, say, an obstacle
blocks a narrow gap, the path nding will seek an alternative route to the target. Without carving, the agent will
head for the gap but won't be able to pass until the obstacle is clear.
See Also: NavMeshAgent.
Properties
carveOnlyStationary
Should this obstacle be carved when it is constantly moving?
carving
Should this obstacle make a cut-out in the navmesh.
carvingMoveThreshold
Threshold distance for updating a moving carved hole (when carving is enabled).
carvingTimeToStationary
Time to wait until obstacle is treated as stationary (when carving and
carveOnlyStationary are enabled).
center
The center of the obstacle, measured in the object's local space.
height
Height of the obstacle's cylinder shape.
radius
Radius of the obstacle's capsule shape.
shape
The shape of the obstacle.
size
The size of the obstacle, measured in the object's local space.
velocity
Velocity at which the obstacle moves around the NavMesh.
Inherited Members
Properties
enabled
Enabled Behaviours are Updated, disabled Behaviours are not.
isActiveAndEnabled
Has the Behaviour had active and enabled called?
gameObject
The game object this component is attached to. A component is always attached to a
game object.
tag
The tag of this game object.
transform
The Transform attached to this GameObject.
hideFlags
Should the object be hidden, saved with the Scene or modi able by the user?
name
The name of the object.
Public Methods
BroadcastMessage
Calls the method named methodName on every MonoBehaviour in this game
object or any of its children.
CompareTag
Is this game object tagged with tag ?
GetComponent
Returns the component of Type type if the game object has one attached, null if
it doesn't.
GetComponentInChildren
Returns the component of Type type in the GameObject or any of its children
using depth rst search.
GetComponentInParent
Returns the component of Type type in the GameObject or any of its parents.
GetComponents
Returns all components of Type type in the GameObject.
GetComponentsInChildren
Returns all components of Type type in the GameObject or any of its children.
GetComponentsInParent
Returns all components of Type type in the GameObject or any of its parents.
SendMessage
Calls the method named methodName on every MonoBehaviour in this game
object.
SendMessageUpwards
Calls the method named methodName on every MonoBehaviour in this game
object and on every ancestor of the behaviour.
GetInstanceID
Returns the instance id of the object.
ToString
Returns the name of the GameObject.
Static Methods
Destroy
Removes a gameobject, component or asset.
DestroyImmediate
Destroys the object obj immediately. You are strongly recommended to use Destroy
instead.
DontDestroyOnLoad
Makes the object target not be destroyed automatically when loading a new Scene.
FindObjectOfType
Returns the rst active loaded object of Type type.
FindObjectsOfType
Returns a list of all active loaded objects of Type type.
Instantiate
Clones the object original and returns the clone.
Operators
bool
Does the object exist?
operator !=
Compares if two objects refer to a di erent object.
operator ==
Compares two object references to see if they refer to the same object.
Leave feedback
Description
A path as calculated by the navigation system.
The path is represented as a list of waypoints stored in the corners array. These points are not set directly from
user scripts but a NavMeshPath with points correctly assigned is returned by the NavMesh.CalculatePath function
and the NavMeshAgent.path property.
Properties
corners
Corner points of the path. (Read Only)
status
Status of the path. (Read Only)
Constructors
NavMeshPath
NavMeshPath constructor.
Public Methods
ClearCorners
Erase all corner points from path.
GetCornersNonAlloc
Calculate the corners for the path.
Leave feedback
Description
Speci es which agent type and areas to consider when searching the NavMesh.
This struct is used with the NavMesh query methods overloaded with the query lter argument. See Also:
NavMesh.CalculatePath, NavMesh.Raycast, NavMesh.FindClosestEdge, NavMesh.SamplePosition.
Properties
agentTypeID
The agent type ID, specifying which navigation meshes to consider for the query
functions.
areaMask
A bitmask representing the traversable area types.
Public Methods
GetAreaCost
Returns the area cost multiplier for the given area type for this lter.
SetAreaCost
Sets the path nding cost multiplier for this lter for a given area type.
Leave feedback
Description
Contains data describing a triangulation of a navmesh.
Properties
areas
NavMesh area indices for the navmesh triangulation.
indices
Triangle indices for the navmesh triangulation.
vertices
Vertices for the navmesh triangulation.
Leave feedback
Description
Link allowing movement outside the planar navigation mesh.
Properties
activated
Is link active.
area
NavMesh area index for this O MeshLink component.
autoUpdatePositions
Automatically update endpoints.
biDirectional
Can link be traversed in both directions.
costOverride
Modify path nding cost for the link.
endTransform
The transform representing link end position.
occupied
Is link occupied. (Read Only)
startTransform
The transform representing link start position.
Public Methods
UpdatePositions
Explicitly update the link endpoints.
Inherited Members
Properties
enabled
Enabled Behaviours are Updated, disabled Behaviours are not.
isActiveAndEnabled
Has the Behaviour had active and enabled called?
gameObject
The game object this component is attached to. A component is always attached to a
game object.
tag
The tag of this game object.
transform
The Transform attached to this GameObject.
hideFlags
Should the object be hidden, saved with the Scene or modi able by the user?
name
The name of the object.
Public Methods
BroadcastMessage
Calls the method named methodName on every MonoBehaviour in this game
object or any of its children.
CompareTag
Is this game object tagged with tag ?
GetComponent
Returns the component of Type type if the game object has one attached, null if
it doesn't.
GetComponentInChildren
Returns the component of Type type in the GameObject or any of its children
using depth rst search.
GetComponentInParent
Returns the component of Type type in the GameObject or any of its parents.
GetComponents
Returns all components of Type type in the GameObject.
GetComponentsInChildren
Returns all components of Type type in the GameObject or any of its children.
GetComponentsInParent
Returns all components of Type type in the GameObject or any of its parents.
SendMessage
Calls the method named methodName on every MonoBehaviour in this game
object.
SendMessageUpwards
Calls the method named methodName on every MonoBehaviour in this game
object and on every ancestor of the behaviour.
GetInstanceID
Returns the instance id of the object.
ToString
Returns the name of the GameObject.
Static Methods
Destroy
Removes a gameobject, component or asset.
DestroyImmediate
Destroys the object obj immediately. You are strongly recommended to use Destroy
instead.
DontDestroyOnLoad
Makes the object target not be destroyed automatically when loading a new Scene.
FindObjectOfType
Returns the rst active loaded object of Type type.
FindObjectsOfType
Returns a list of all active loaded objects of Type type.
Instantiate
Clones the object original and returns the clone.
Operators
bool
Does the object exist?
operator !=
Compares if two objects refer to a di erent object.
operator ==
Compares two object references to see if they refer to the same object.
Leave feedback
Description
State of O MeshLink.
Properties
activated
Is link active (Read Only).
endPos
Link end world position (Read Only).
linkType
Link type speci er (Read Only).
o MeshLink
The O MeshLink if the link type is a manually placed O meshlink (Read Only).
startPos
Link start world position (Read Only).
valid
Is link valid (Read Only).
Leave feedback
Description
Bitmask used for operating with debug data from the NavMesh build process.
Used in two situations:
- within NavMeshBuildSettings.debug to specify which debug data to retain after the build process has completed,
preserving the world position and orientation;
- as a parameter of NavMeshEditorHelpers.DrawBuildDebug to control which of the available debug data types to
display for a speci ed NavMesh.
See Also: NavMeshBuildSettings.
Properties
None
No debug data from the NavMesh build process is taken into consideration.
InputGeometry
The triangles of all the geometry that is used as a base for computing the new
NavMesh.
Voxels
The voxels produced by rasterizing the source geometry into walkable and
unwalkable areas.
Regions
The segmentation of the traversable surfaces into smaller areas necessary for
producing simple polygons.
RawContours
The contours that follow precisely the edges of each surface region.
Simpli edContours
Contours bounding each of the surface regions, described through fewer vertices and
straighter edges compared to RawContours.
PolygonMeshes
Meshes of convex polygons constructed within the uni ed contours of adjacent
regions.
PolygonMeshesDetail
The triangulated meshes with height details that better approximate the source
geometry.
All
All debug data from the NavMesh build process is taken into consideration.
Leave feedback
Description
Used with NavMeshBuildSource to de ne the shape for building NavMesh.
Properties
Mesh
Describes a Mesh source for use with NavMeshBuildSource.
Terrain
Describes a TerrainData source for use with NavMeshBuildSource.
Box
Describes a box primitive for use with NavMeshBuildSource.
Sphere
Describes a sphere primitive for use with NavMeshBuildSource.
Capsule
Describes a capsule primitive for use with NavMeshBuildSource.
Modi erBox
Describes a Modi erBox source for use with NavMeshBuildSource.
Leave feedback
Description
Used for specifying the type of geometry to collect. Used with NavMeshBuilder.CollectSources.
Properties
RenderMeshes
Collect meshes form the rendered geometry.
PhysicsColliders
Collect geometry from the 3D physics collision representation.
Leave feedback
Description
Shape of the obstacle.
Properties
Capsule
Capsule shaped obstacle.
Box
Box shaped obstacle.
Leave feedback
Description
Status of path.
Properties
PathComplete
The path terminates at the destination.
PathPartial
The path cannot reach the destination.
PathInvalid
The path is invalid.
Leave feedback
Description
Level of obstacle avoidance.
Properties
NoObstacleAvoidance
Disable avoidance.
LowQualityObstacleAvoidance
Enable simple avoidance. Low performance impact.
MedQualityObstacleAvoidance
Medium avoidance. Medium performance impact.
GoodQualityObstacleAvoidance
Good avoidance. High performance impact.
HighQualityObstacleAvoidance
Enable highest precision. Highest performance impact.
Leave feedback
Description
Link type speci er.
Properties
LinkTypeManual
Manually speci ed type of link.
LinkTypeDropDown
Vertical drop.
LinkTypeJumpAcross
Horizontal jump.
Leave feedback
Description
Unity Analytics provides insight into your game users e.g. DAU, MAU.
Note: The documentation that follows is for usage of Unity Analytics with Unity 5.1 and above. To integrate Unity
Analytics with earlier versions of Unity, refer to the documentation at https://analytics.cloud.unity3d.com/docs
Speci cally, out-of-the-box features include access to user engagement and retention data through Metric
Monitor and Data Explorer. Segmentation of players across various user dimensions and characteristics is
automatically applied, with more than 20 standard segments available without any additional instrumentation.
For more detail around features, refer to the Unity Analytics homepage at http://unity3d.com/unity/analytics.
Static Properties
deviceStatsEnabled
Controls whether the sending of device stats at runtime is enabled.
enabled
Controls whether the Analytics service is enabled at runtime.
limitUserTracking
Controls whether to limit user tracking at runtime.
Static Methods
CustomEvent
Custom Events (optional).
FlushEvents
Attempts to ush immediately all queued analytics events to the network and lesystem
cache if possible (optional).
RegisterEvent
This API is used for registering a Runtime Analytics event. It is meant for internal use only
and is likely to change in the future. User code should never use this API.
SendEvent
This API is used to send a Runtime Analytics event. It is meant for internal use only and is
likely to change in the future. User code should never use this API.
SetUserBirthYear
User Demographics (optional).
SetUserGender
User Demographics (optional).
SetUserId
User Demographics (optional).
Transaction
Tracking Monetization (optional).
Leave feedback
Description
The main class of the Unity Analytics Standard Event SDK.
The event methods in this class provide ' re and forget' ease of use, allowing you to send a standard event with a
single line of code. If you expect to be sending the same standard event with some amount of frequency, you may
want to create an event payload and invoke the Send method when the event occurs. The event methods in this
class provide " re and forget" ease of use, allowing you to send a standard event with a single line of code. If you
expect to be sending the same standard event with some amount of frequency, you may want to create an event
payload and invoke the Send method when the event occurs.
Static Properties
debugMode
Gets or sets a value indicating whether debug mode is enabled.
sdkVersion
Gets the Unity Analytics Standard Event SDK version.
Static Methods
AchievementStep
Sends a achievement_step event.
AchievementUnlocked
Sends a achievement_unlocked event.
AdComplete
Sends a ad_complete event.
AdO er
Sends a ad_o er event.
AdSkip
Sends a ad_skip event.
AdStart
Sends a ad_start event.
ChatMessageSent
Sends a chat_message_sent event.
Custom
Sends a custom event (eventName) with data (eventData)
CustomEvent
Sends a custom event.
CutsceneSkip
Sends a cutscene_skip event.
CutsceneStart
Sends a cutscene_start event.
FirstInteraction
Sends a rst_interaction event.
GameOver
Sends a game_over event.
GameStart
Sends a game_start event.
IAPTransaction
Sends a iap_transaction event.
ItemAcquired
Sends a item_acquired event.
ItemSpent
Sends a item_spent event.
LevelComplete
Sends a level_complete event.
LevelFail
Sends a level_fail event.
LevelQuit
Sends a level_quit event.
LevelSkip
Sends a level_skip event.
LevelStart
Sends a level_start event.
LevelUp
Sends a level_up event.
PostAdAction
Sends a post_ad_action event.
PushNoti cationClick
Sends a push_noti cation_click event.
PushNoti cationEnable
Sends a push_noti cation_enable event.
ScreenVisit
Sends a screen_visit event.
SocialShare
Sends a social_share event.
SocialShareAccept
Sends a social_share_accept event.
StoreItemClick
Sends a store_item_click event.
StoreOpened
Sends a store_opened event.
TutorialComplete
Sends a tutorial_complete event.
TutorialSkip
Sends a tutorial_skip event.
TutorialStart
Sends a tutorial_start event.
TutorialStep
Sends a tutorial_step event.
UserSignup
Sends a user_signup event.
Leave feedback
Description
Provides access to the Analytics session information for the current game instance.
This class contains static methods for looking up Analytics session information. Note that cumulative statistics are
reset if the player re-installs the game.
using
using
using
using
using
System.Collections;
System.Collections.Generic;
UnityEngine;
UnityEngine.Analytics;
System;
public class NewBehaviourScript : MonoBehaviour
{
void Start()
{
Debug.Log("Start
" + AnalyticsSessionInfo.userId + " " + AnalyticsSess
AnalyticsSessionInfo.sessionStateChanged += OnSessionStateChanged;
}
void OnSessionStateChanged(AnalyticsSessionState sessionState, long sessionI
{
Debug.Log("Call
" + AnalyticsSessionInfo.userId + " " + sessionState
}
}
Static Properties
sessionCount
The number of sessions played since the app was installed.
sessionElapsedTime
The time elapsed, in milliseconds, since the beginning of the current game session.
sessionFirstRun
Reports whether the current session is the rst session since the player installed the
game or application.
sessionId
A random, unique GUID identifying the current game or app session.
sessionState
The current state of the session.
userId
A random GUID uniquely identifying sessions played on the same instance of your
game or app.
Events
sessionStateChanged
Dispatched when the Analytics session state changes.
Delegates
SessionStateChanged
Dispatched when the Analytics session state changes.
Leave feedback
Obsolete
Description
Automatically create and send analytics events based on a variety of triggers.
Set event name, parameter names, and automatically use parameter values either from properties of attached
Components or from literal values. Send the instrumented event.
Inherited Members
Properties
enabled
Enabled Behaviours are Updated, disabled Behaviours are not.
isActiveAndEnabled
Has the Behaviour had active and enabled called?
gameObject
The game object this component is attached to. A component is always attached to a
game object.
tag
The tag of this game object.
transform
The Transform attached to this GameObject.
runInEditMode
Allow a speci c instance of a MonoBehaviour to run in edit mode (only available in the
editor).
useGUILayout
Disabling this lets you skip the GUI layout phase.
hideFlags
Should the object be hidden, saved with the Scene or modi able by the user?
name
The name of the object.
Public Methods
BroadcastMessage
Calls the method named methodName on every MonoBehaviour in this game
object or any of its children.
CompareTag
Is this game object tagged with tag ?
GetComponent
Returns the component of Type type if the game object has one attached, null if
it doesn't.
GetComponentInChildren
Returns the component of Type type in the GameObject or any of its children
using depth rst search.
GetComponentInParent
Returns the component of Type type in the GameObject or any of its parents.
GetComponents
Returns all components of Type type in the GameObject.
GetComponentsInChildren
Returns all components of Type type in the GameObject or any of its children.
GetComponentsInParent
Returns all components of Type type in the GameObject or any of its parents.
SendMessage
Calls the method named methodName on every MonoBehaviour in this game
object.
SendMessageUpwards
Calls the method named methodName on every MonoBehaviour in this game
object and on every ancestor of the behaviour.
CancelInvoke
Cancels all Invoke calls on this MonoBehaviour.
Invoke
Invokes the method methodName in time seconds.
InvokeRepeating
Invokes the method methodName in time seconds, then repeatedly every
repeatRate seconds.
IsInvoking
Is any invoke on methodName pending?
StartCoroutine
Starts a coroutine.
StopAllCoroutines
Stops all coroutines running on this behaviour.
StopCoroutine
Stops the rst coroutine named methodName, or the coroutine stored in routine
running on this behaviour.
GetInstanceID
Returns the instance id of the object.
ToString
Returns the name of the GameObject.
Static Methods
print
Logs message to the Unity Console (identical to Debug.Log).
Destroy
Removes a gameobject, component or asset.
DestroyImmediate
Destroys the object obj immediately. You are strongly recommended to use Destroy
instead.
DontDestroyOnLoad
Makes the object target not be destroyed automatically when loading a new Scene.
FindObjectOfType
Returns the rst active loaded object of Type type.
FindObjectsOfType
Returns a list of all active loaded objects of Type type.
Instantiate
Clones the object original and returns the clone.
Operators
bool
Does the object exist?
operator !=
Compares if two objects refer to a di erent object.
operator ==
Compares two object references to see if they refer to the same object.
Messages
Awake
Awake is called when the script instance is being loaded.
FixedUpdate
This function is called every xed framerate frame, if the
MonoBehaviour is enabled.
LateUpdate
LateUpdate is called every frame, if the Behaviour is enabled.
OnAnimatorIK
Callback for setting up animation IK (inverse kinematics).
OnAnimatorMove
Callback for processing animation movements for modifying root
motion.
OnApplicationFocus
Sent to all GameObjects when the player gets or loses focus.
OnApplicationPause
Sent to all GameObjects when the application pauses.
OnApplicationQuit
Sent to all game objects before the application quits.
OnAudioFilterRead
If OnAudioFilterRead is implemented, Unity will insert a custom lter
into the audio DSP chain.
OnBecameInvisible
OnBecameInvisible is called when the renderer is no longer visible by
any camera.
OnBecameVisible
OnBecameVisible is called when the renderer became visible by any
camera.
OnCollisionEnter
OnCollisionEnter is called when this collider/rigidbody has begun
touching another rigidbody/collider.
OnCollisionEnter2D
Sent when an incoming collider makes contact with this object's collider
(2D physics only).
OnCollisionExit
OnCollisionExit is called when this collider/rigidbody has stopped
touching another rigidbody/collider.
OnCollisionExit2D
Sent when a collider on another object stops touching this object's
collider (2D physics only).
OnCollisionStay
:ref::OnCollisionStay is called once per frame for every
collider/rigidbody that is touching rigidbody/collider.
OnCollisionStay2D
Sent each frame where a collider on another object is touching this
object's collider (2D physics only).
OnConnectedToServer
Called on the client when you have successfully connected to a server.
OnControllerColliderHit
OnControllerColliderHit is called when the controller hits a collider while
performing a Move.
OnDestroy
Destroying the attached Behaviour will result in the game or Scene
receiving OnDestroy.
OnDisable
This function is called when the behaviour becomes disabled.
OnDisconnectedFromServer
Called on the client when the connection was lost or you disconnected
from the server.
OnDrawGizmos
Implement OnDrawGizmos if you want to draw gizmos that are also
pickable and always drawn.
OnDrawGizmosSelected
Implement OnDrawGizmosSelected to draw a gizmo if the object is
selected.
OnEnable
This function is called when the object becomes enabled and active.
OnFailedToConnect
Called on the client when a connection attempt fails for some reason.
OnFailedToConnectToMasterServer
Called on clients or servers when there is a problem connecting to the
MasterServer.
OnGUI
OnGUI is called for rendering and handling GUI events.
OnJointBreak
Called when a joint attached to the same game object broke.
OnJointBreak2D
Called when a Joint2D attached to the same game object breaks.
OnMasterServerEvent
Called on clients or servers when reporting events from the
MasterServer.
OnMouseDown
OnMouseDown is called when the user has pressed the mouse button
while over the GUIElement or Collider.
OnMouseDrag
OnMouseDrag is called when the user has clicked on a GUIElement or
Collider and is still holding down the mouse.
OnMouseEnter
Called when the mouse enters the GUIElement or Collider.
OnMouseExit
Called when the mouse is not any longer over the GUIElement or
Collider.
OnMouseOver
Called every frame while the mouse is over the GUIElement or Collider.
OnMouseUp
OnMouseUp is called when the user has released the mouse button.
OnMouseUpAsButton
OnMouseUpAsButton is only called when the mouse is released over
the same GUIElement or Collider as it was pressed.
OnNetworkInstantiate
Called on objects which have been network instantiated with
Network.Instantiate.
OnParticleCollision
OnParticleCollision is called when a particle hits a Collider.
OnParticleSystemStopped
OnParticleSystemStopped is called when all particles in the system have
died, and no new particles will be born. New particles cease to be
created either after Stop is called, or when the duration property of a
non-looping system has been exceeded.
OnParticleTrigger
OnParticleTrigger is called when any particles in a particle system meet
the conditions in the trigger module.
OnPlayerConnected
Called on the server whenever a new player has successfully connected.
OnPlayerDisconnected
Called on the server whenever a player disconnected from the server.
OnPostRender
OnPostRender is called after a camera nished rendering the Scene.
OnPreCull
OnPreCull is called before a camera culls the Scene.
OnPreRender
OnPreRender is called before a camera starts rendering the Scene.
OnRenderImage
OnRenderImage is called after all rendering is complete to render
image.
OnRenderObject
OnRenderObject is called after camera has rendered the Scene.
OnSerializeNetworkView
Used to customize synchronization of variables in a script watched by a
network view.
OnServerInitialized
Called on the server whenever a Network.InitializeServer was invoked
and has completed.
OnTransformChildrenChanged
This function is called when the list of children of the transform of the
GameObject has changed.
OnTransformParentChanged
This function is called when the parent property of the transform of the
GameObject has changed.
OnTriggerEnter
OnTriggerEnter is called when the Collider other enters the trigger.
OnTriggerEnter2D
Sent when another object enters a trigger collider attached to this
object (2D physics only).
OnTriggerExit
OnTriggerExit is called when the Collider other has stopped touching
the trigger.
OnTriggerExit2D
Sent when another object leaves a trigger collider attached to this
object (2D physics only).
OnTriggerStay
OnTriggerStay is called once per physics update for every Collider other
that is touching the trigger.
OnTriggerStay2D
Sent each frame where another object is within a trigger collider
attached to this object (2D physics only).
OnValidate
This function is called when the script is loaded or a value is changed in
the inspector (Called in the editor only).
OnWillRenderObject
OnWillRenderObject is called for each camera if the object is visible and
not a UI element.
Reset
Reset to default values.
Start
Start is called on the frame when a script is enabled just before any of
the Update methods are called the rst time.
Update
Update is called every frame, if the MonoBehaviour is enabled.
Leave feedback
Description
Unity Performace provides insight into your game performace.
Static Properties
enabled
Controls whether the Performance Reporting service is enabled at runtime.
graphicsInitializationFinishTime
Time taken to initialize graphics in microseconds, measured from
application startup.
Leave feedback
Description
The source through which an item, consumable, or currency was acquired.
Properties
None
No available source, or source unknown. Note: Use a string value if the acquisition source
is not one of the elements de ned in this enumeration.
Store
Purchased using currency or consumable resources.
Earned
Awarded through an achievement or other in-game interaction.
Promotion
Granted as a promotion of some in-game feature or through cross promotion.
Gift
Granted without motive other than good feelings.
RewardedAd
Granted as a reward for watching an advertisement.
TimedReward
Granted periodically.
SocialReward
Granted through social engagement.
Leave feedback
Description
The type of currency (premium or soft) used to acquire the item.
See Also: AnalyticsEvent.ItemAcquired.
Properties
Soft
Not directly purchased with real-world money.
Premium
Purchased with real-world money.
Leave feedback
Description
The list of advertising or mediation network service providers.
Use the members of this list when possible to promote consistency in your Analytics data. However, if the
advertising network is not included in this list, pass the argument to the Standard Event function as a string.
See Also: AnalyticsEvent.AdComplete, AnalyticsEvent.AdO er, AnalyticsEvent.AdSkip, AnalyticsEvent.AdStart,
AnalyticsEvent.PostAdAction.
Properties
None
No available network, or network unknown. Note: Use a string value to indicate a network
not de ned in this enumeration.
Aarki
Aarki network.
AdAction
AdAction network.
AdapTv
AdapTv network.
Adcash
Adcash network.
AdColony
AdColony network.
AdMob
AdMob network.
AerServ
AerServ network.
Airpush
Airpush network.
Altrooz
Altrooz network.
Ampush
Ampush network.
AppleSearch
AppleSearch network.
AppLift
AppLift network.
AppLovin
AppLovin network.
Appnext
Appnext network.
AppNexus
AppNexus network.
Appoday
Appoday network.
Appodeal
Appodeal network.
AppsUnion
AppsUnion network.
Avazu
Avazu network.
BlueStacks
BlueStacks network.
Chartboost
Chartboost network.
ClickDealer
ClickDealer network.
CPAlead
CPAlead network.
CrossChannel
CrossChannel network.
CrossInstall
CrossInstall network.
Epom
Epom network.
Facebook
Facebook network.
Fetch
Fetch network.
Fiksu
Fiksu network.
Flurry
Flurry network.
Fuse
Fuse network.
Fyber
Fyber network.
Glispa
Glispa network.
Google
Google network.
GrowMobile
GrowMobile network.
HeyZap
HeyZap network.
HyperMX
HyperMX network.
Iddiction
Iddiction network.
IndexExchange
IndexExchange network.
InMobi
InMobi network.
Instagram
Instagram network.
Instal
Instal network.
Ipsos
Ipsos network.
IronSource
IronSource network.
Jirbo
Jirbo network.
Kimia
Kimia network.
Leadbolt
Leadbolt network.
Lifto
Lifto network.
Manage
Manage network.
Matomy
Matomy network.
MediaBrix
MediaBrix network.
MillenialMedia
MillenialMedia network.
Minimob
Minimob network.
MobAir
MobAir network.
MobileCore
MobileCore network.
Mobobeat
Mobobeat network.
Mobusi
Mobusi network.
Mobvista
Mobvista network.
MoPub
MoPub network.
Motive
Motive network.
Msales
Msales network.
NativeX
NativeX network.
OpenX
OpenX network.
Pandora
Pandora network.
PropellerAds
PropellerAds network.
Revmob
Revmob network.
RubiconProject
RubiconProject network.
SiriusAd
SiriusAd network.
Smaato
Smaato network.
SponsorPay
SponsorPay network.
SpotXchange
SpotXchange network.
StartApp
StartApp network.
Tapjoy
Tapjoy network.
Taptica
Taptica network.
Tremor
Tremor network.
TrialPay
TrialPay network.
Twitter
Twitter network.
UnityAds
UnityAds network.
Vungle
Vungle network.
Yeahmobi
Yeahmobi network.
YuMe
YuMe network.
Leave feedback
Description
Analytics API result.
Properties
Ok
Analytics API result: Success.
NotInitialized
Analytics API result: Analytics not initialized.
AnalyticsDisabled
Analytics API result: Analytics is disabled.
TooManyItems
Analytics API result: Too many parameters.
SizeLimitReached
Analytics API result: Argument size limit.
TooManyRequests
Analytics API result: Too many requests.
InvalidData
Analytics API result: Invalid argument value.
UnsupportedPlatform
Analytics API result: This platform doesn't support Analytics.
Leave feedback
Description
Session tracking states.
Properties
kSessionStopped
Session tracking has stopped.
kSessionStarted
Session tracking has started.
kSessionPaused
Session tracking has paused.
kSessionResumed
Session tracking has resumed.
Leave feedback
Description
The list of authorization networks for in-game login sessions.
Use the members of this list when possible to promote consistency in your Analytics data. However, if the
authorization network is not included in this list, pass the argument to the Standard Event function as a string.
See Also: AnalyticsEvent.UserSignup.
Properties
None
No available authorization network, or network unknown. Note: Use a string value to
indicate an authorization network not de ned in this enumeration.
Internal
You use your own authorization system.
Facebook
Facebook authorization.
Twitter
Twitter authorization.
Google
Google authorization.
GameCenter
GameCenter authorization.
Leave feedback
Description
User Demographics: Gender of a user.
Properties
Male
User Demographics: Male Gender of a user.
Female
User Demographics: Female Gender of a user.
Unknown
User Demographics: Unknown Gender of a user.
Leave feedback
Description
The list of the in-game screen or interface types.
Use the members of this list when possible to promote consistency in your Analytics data. However, if the screen
name is not included in this list, pass the argument to the Standard Event function as a string.
See Also: AnalyticsEvent.ScreenVisit.
Properties
None
No de ned screen name. Note: Use a string value to indicate a screen name not de ned
in this enumeration.
MainMenu
The game's main menu screen.
Settings
The game's settings screen.
Map
The game's map screen.
Lose
The screen shown when the player loses the game.
Win
The screen shown when the player wins the game.
Credits
The game's credits screen.
Title
The game's title screen.
IAPPromo
The screen shown for IAP promotions.
CrossPromo
The screen shown for cross promotions.
FeaturePromo
The screen shown for feature promotions.
Hint
The game's hint screen.
Pause
The game's pause screen.
Inventory
The game's inventory screen.
Leaderboard
The game's leaderboard screen.
Achievements
The game's achievement screen.
Lobby
The game's lobby screen.
Leave feedback
Description
The list of media types or modes used for social engagements.
Use the members of this list when possible to promote consistency in your Analytics data. However, if the media
type or mode is not included in this list, pass the argument to the Standard Event function as a string.
See Also: AnalyticsEvent.SocialShare, AnalyticsEvent.SocialShareAccept.
Properties
None
No de ned engagement media or mode. Note: Use a string value to indicate a mode of
social engagement not de ned in this enumeration.
TextOnly
A text-based mode of engagement, such as a text or chat message.
Image
An image-based mode of engagement.
Video
A video-based mode of engagement.
Invite
A mode of engagement that involves an invitation.
Achievement
An in-game achievement.
Leave feedback
Description
The list of social networks used with social engagements.
Use the members of this list when possible to promote consistency in your Analytics data. However, if the social
network is not included in this list, pass the argument to the Standard Event function as a string.
See Also: AnalyticsEvent.SocialShare, AnalyticsEvent.SocialShareAccept.
Properties
None
No available social network, or network unknown. Note: Use a string value to indicate
social network not de ned in this enumeration.
Facebook
Facebook.
Twitter
Twitter.
Instagram
Instagram.
GooglePlus
Google Plus.
Pinterest
Pinterest.
WeChat
WeChat.
SinaWeibo
The Sina Weibo social network.
TencentWeibo
The Tencent Weibo social network.
QQ
QQ and QZone networks.
Zhihu
Zhihu network.
VK
VKontakte network.
OK_ru
Odnoklassniki network.
Leave feedback
Description
The list of in-game store categories.
See Also: AnalyticsEvent.StoreItemClick, AnalyticsEvent.StoreOpened
Properties
Soft
Contains items purchasable with in-game currency only.
Premium
Contains items purchasable with real-world money.
Leave feedback
Implements interfaces:IConstraint
Description
Constrains the orientation of an object relative to the position of one or more source objects, such that the object
is facing the average position of the sources.
Properties
aimVector
The axis towards which the constrained object orients.
constraintActive
Activates or deactivates the constraint.
locked
Locks the o set and rotation at rest.
rotationAtRest
The rotation used when the sources have a total weight of 0.
rotationAxis
The axes a ected by the AimConstraint.
rotationO set
Represents an o set from the constrained orientation.
sourceCount
The number of sources set on the component (read-only).
upVector
The up vector.
weight
The weight of the constraint component.
worldUpObject
The world up object, used to calculate the world up vector when the world up Type is
AimConstraint.WorldUpType.ObjectUp or AimConstraint.WorldUpType.ObjectRotationUp.
worldUpType
The type of the world up vector.
worldUpVector
The world up Vector used when the world up type is AimConstraint.WorldUpType.Vector
or AimConstraint.WorldUpType.ObjectRotationUp.
Public Methods
AddSource
Adds a constraint source.
GetSource
Gets a constraint source by index.
GetSources
Gets the list of sources.
RemoveSource
Removes a source from the component.
SetSource
Sets a source at a speci ed index.
SetSources
Sets the list of sources on the component.
Inherited Members
Properties
enabled
Enabled Behaviours are Updated, disabled Behaviours are not.
isActiveAndEnabled
Has the Behaviour had active and enabled called?
gameObject
The game object this component is attached to. A component is always attached to a
game object.
tag
The tag of this game object.
transform
The Transform attached to this GameObject.
hideFlags
Should the object be hidden, saved with the Scene or modi able by the user?
name
The name of the object.
Public Methods
BroadcastMessage
Calls the method named methodName on every MonoBehaviour in this game
object or any of its children.
CompareTag
Is this game object tagged with tag ?
GetComponent
Returns the component of Type type if the game object has one attached, null if
it doesn't.
GetComponentInChildren
Returns the component of Type type in the GameObject or any of its children
using depth rst search.
GetComponentInParent
Returns the component of Type type in the GameObject or any of its parents.
GetComponents
Returns all components of Type type in the GameObject.
GetComponentsInChildren
Returns all components of Type type in the GameObject or any of its children.
GetComponentsInParent
Returns all components of Type type in the GameObject or any of its parents.
SendMessage
Calls the method named methodName on every MonoBehaviour in this game
object.
SendMessageUpwards
Calls the method named methodName on every MonoBehaviour in this game
object and on every ancestor of the behaviour.
GetInstanceID
Returns the instance id of the object.
ToString
Returns the name of the GameObject.
Static Methods
Destroy
Removes a gameobject, component or asset.
DestroyImmediate
Destroys the object obj immediately. You are strongly recommended to use Destroy
instead.
DontDestroyOnLoad
Makes the object target not be destroyed automatically when loading a new Scene.
FindObjectOfType
Returns the rst active loaded object of Type type.
FindObjectsOfType
Returns a list of all active loaded objects of Type type.
Instantiate
Clones the object original and returns the clone.
Operators
bool
Does the object exist?
operator !=
Compares if two objects refer to a di erent object.
operator ==
Compares two object references to see if they refer to the same object.
Leave feedback
Description
Speci es how the world up vector used by the aim constraint is de ned.
Properties
SceneUp
Uses and de nes the world up vector as the Unity Scene up vector (the Y axis).
ObjectUp
Uses and de nes the world up vector as a vector from the constrained object, in the
direction of the up object.
ObjectRotationUp
Uses and de nes the world up vector as relative to the local space of the object.
Vector
Uses and de nes the world up vector as a vector speci ed by the user.
None
Neither de nes nor uses a world up vector.
Leave feedback
Implements interfaces:IPlayable
Description
A Playable that controls an AnimationClip.
NOTE: You can use PlayableExtensions methods with AnimationClipPlayable objects.
Public Methods
GetAnimationClip
Returns the AnimationClip stored in the AnimationClipPlayable.
GetApplyFootIK
Returns the state of the ApplyFootIK ag.
GetApplyPlayableIK
Returns the state of the ApplyPlayableIK ag.
SetApplyFootIK
Sets the value of the ApplyFootIK ag.
SetApplyPlayableIK
Requests OnAnimatorIK to be called on the animated GameObject.
Static Methods
Create
Creates an AnimationClipPlayable in the PlayableGraph.
Leave feedback
Implements interfaces:IPlayable
Description
An implementation of IPlayable that controls an animation layer mixer.
NOTE: You can use PlayableExtensions methods with AnimationLayerMixerPlayable objects.
Static Properties
Null
Returns an invalid AnimationLayerMixerPlayable.
Public Methods
IsLayerAdditive
Returns true if the layer is additive, false otherwise.
SetLayerAdditive
Speci es whether a layer is additive or not. Additive layers blend with
previous layers.
SetLayerMaskFromAvatarMask
Sets the mask for the current layer.
Static Methods
Create
Creates an AnimationLayerMixerPlayable in the PlayableGraph.
Leave feedback
Implements interfaces:IPlayable
Description
An implementation of IPlayable that controls an animation mixer.
NOTE: You can use PlayableExtensions methods with AnimationMixerPlayable objects.
Static Properties
Null
Returns an invalid AnimationMixerPlayable.
Static Methods
Create
Creates an AnimationMixerPlayable in the PlayableGraph.
Leave feedback
Description
A PlayableBinding that contains information representing an AnimationPlayableOutput.
Static Methods
Create
Creates a PlayableBinding that contains information representing an
AnimationPlayableOutput.
Leave feedback
Implements interfaces:IPlayableOutput
Description
A IPlayableOutput implementation that connects the PlayableGraph to an Animator in the Scene.
NOTE: You can use PlayableOutputExtensions methods on AnimationPlayableOutput objects.
Public Methods
GetTarget
Returns the Animator that plays the animation graph.
SetTarget
Sets the Animator that plays the animation graph.
Static Methods
Create
Creates an AnimationPlayableOutput in the PlayableGraph.
Leave feedback
Implements interfaces:IPlayable
Description
An implementation of IPlayable that controls an animation RuntimeAnimatorController.
NOTE: You can use PlayableExtensions methods with AnimatorControllerPlayable objects.
Static Properties
Null
Returns an invalid AnimatorControllerPlayable.
Static Methods
Create
Creates an AnimatorControllerPlayable in the PlayableGraph.
Leave feedback
Description
Represents a source for the constraint.
Properties
sourceTransform
The transform component of the source object.
weight
The weight of the source in the evaluation of the constraint.
Leave feedback
Implements interfaces:IConstraint
Description
Constrains the orientation of an object relative to the position of one or more source objects, such that the object
is facing the average position of the sources. The LookAtConstraint is a simpli ed AimConstraint typically used
with a Camera.
Properties
constraintActive
Activates or deactivates the constraint.
locked
Locks the o set and rotation at rest.
roll
The rotation angle along the z axis of the object. The constraint uses this property to
calculate the world up vector when Animations.LookAtConstraint.UseUpObject is false.
rotationAtRest
The rotation used when the sources have a total weight of 0.
rotationO set
Represents an o set from the constrained orientation.
sourceCount
The number of sources set on the component (Read Only).
useUpObject
Determines how the up vector is calculated.
weight
The weight of the constraint component.
worldUpObject
The world up object, used to calculate the world up vector when
Animations.LookAtConstraint.UseUpObject is true.
Public Methods
AddSource
Adds a constraint source.
GetSource
Gets a constraint source by index.
GetSources
Gets the list of sources.
RemoveSource
Removes a source from the component.
SetSource
Sets a source at a speci ed index.
SetSources
Sets the list of sources on the component.
Inherited Members
Properties
enabled
Enabled Behaviours are Updated, disabled Behaviours are not.
isActiveAndEnabled
Has the Behaviour had active and enabled called?
gameObject
The game object this component is attached to. A component is always attached to a
game object.
tag
The tag of this game object.
transform
The Transform attached to this GameObject.
hideFlags
Should the object be hidden, saved with the Scene or modi able by the user?
name
The name of the object.
Public Methods
BroadcastMessage
Calls the method named methodName on every MonoBehaviour in this game
object or any of its children.
CompareTag
Is this game object tagged with tag ?
GetComponent
Returns the component of Type type if the game object has one attached, null if
it doesn't.
GetComponentInChildren
Returns the component of Type type in the GameObject or any of its children
using depth rst search.
GetComponentInParent
Returns the component of Type type in the GameObject or any of its parents.
GetComponents
Returns all components of Type type in the GameObject.
GetComponentsInChildren
Returns all components of Type type in the GameObject or any of its children.
GetComponentsInParent
Returns all components of Type type in the GameObject or any of its parents.
SendMessage
Calls the method named methodName on every MonoBehaviour in this game
object.
SendMessageUpwards
Calls the method named methodName on every MonoBehaviour in this game
object and on every ancestor of the behaviour.
GetInstanceID
Returns the instance id of the object.
ToString
Returns the name of the GameObject.
Static Methods
Destroy
Removes a gameobject, component or asset.
DestroyImmediate
Destroys the object obj immediately. You are strongly recommended to use Destroy
instead.
DontDestroyOnLoad
Makes the object target not be destroyed automatically when loading a new Scene.
FindObjectOfType
Returns the rst active loaded object of Type type.
FindObjectsOfType
Returns a list of all active loaded objects of Type type.
Instantiate
Clones the object original and returns the clone.
Operators
bool
Does the object exist?
operator !=
Compares if two objects refer to a di erent object.
operator ==
Compares two object references to see if they refer to the same object.
Leave feedback
Implements interfaces:IConstraint
Description
Constrains the orientation and translation of an object to one or more source objects. The constrained object
behaves as if it is in the hierarchy of the sources.
Properties
constraintActive
Activates or deactivates the constraint.
locked
Locks the o sets and position (translation and rotation) at rest.
rotationAtRest
The rotation used when the sources have a total weight of 0.
rotationAxis
The rotation axes a ected by the ParentConstraint.
rotationO sets
The rotation o sets from the constrained orientation.
sourceCount
The number of sources set on the component (read-only).
translationAtRest
The position of the object in local space, used when the sources have a total weight of 0.
translationAxis
The translation axes a ected by the ParentConstraint.
translationO sets
The translation o sets from the constrained orientation.
weight
The weight of the constraint component.
Public Methods
AddSource
Adds a constraint source.
GetRotationO set
Gets the rotation o set associated with a source by index.
GetSource
Gets a constraint source by index.
GetSources
Gets the list of sources.
GetTranslationO set
Gets the rotation o set associated with a source by index.
RemoveSource
Removes a source from the component.
SetRotationO set
Sets the rotation o set associated with a source by index.
SetSource
Sets a source at a speci ed index.
SetSources
Sets the list of sources on the component.
SetTranslationO set
Sets the translation o set associated with a source by index.
Inherited Members
Properties
enabled
Enabled Behaviours are Updated, disabled Behaviours are not.
isActiveAndEnabled
Has the Behaviour had active and enabled called?
gameObject
The game object this component is attached to. A component is always attached to a
game object.
tag
The tag of this game object.
transform
The Transform attached to this GameObject.
hideFlags
Should the object be hidden, saved with the Scene or modi able by the user?
name
The name of the object.
Public Methods
BroadcastMessage
Calls the method named methodName on every MonoBehaviour in this game
object or any of its children.
CompareTag
Is this game object tagged with tag ?
GetComponent
Returns the component of Type type if the game object has one attached, null if
it doesn't.
GetComponentInChildren
Returns the component of Type type in the GameObject or any of its children
using depth rst search.
GetComponentInParent
Returns the component of Type type in the GameObject or any of its parents.
GetComponents
Returns all components of Type type in the GameObject.
GetComponentsInChildren
Returns all components of Type type in the GameObject or any of its children.
GetComponentsInParent
Returns all components of Type type in the GameObject or any of its parents.
SendMessage
Calls the method named methodName on every MonoBehaviour in this game
object.
SendMessageUpwards
Calls the method named methodName on every MonoBehaviour in this game
object and on every ancestor of the behaviour.
GetInstanceID
Returns the instance id of the object.
ToString
Returns the name of the GameObject.
Static Methods
Destroy
Removes a gameobject, component or asset.
DestroyImmediate
Destroys the object obj immediately. You are strongly recommended to use Destroy
instead.
DontDestroyOnLoad
Makes the object target not be destroyed automatically when loading a new Scene.
FindObjectOfType
Returns the rst active loaded object of Type type.
FindObjectsOfType
Returns a list of all active loaded objects of Type type.
Instantiate
Clones the object original and returns the clone.
Operators
bool
Does the object exist?
operator !=
Compares if two objects refer to a di erent object.
operator ==
Compares two object references to see if they refer to the same object.
Leave feedback
Implements interfaces:IConstraint
Description
Constrains the position of an object relative to the position of one or more source objects.
Properties
constraintActive
Activates or deactivates the constraint.
locked
Locks the o set and position at rest.
sourceCount
The number of sources set on the component (read-only).
translationAtRest
The translation used when the sources have a total weight of 0.
translationAxis
The axes a ected by the PositionConstraint.
translationO set
The o set from the constrained position.
weight
The weight of the constraint component.
Public Methods
AddSource
Adds a constraint source.
GetSource
Gets a constraint source by index.
GetSources
Gets the list of sources.
RemoveSource
Removes a source from the component.
SetSource
Sets a source at a speci ed index.
SetSources
Sets the list of sources on the component.
Inherited Members
Properties
enabled
Enabled Behaviours are Updated, disabled Behaviours are not.
isActiveAndEnabled
Has the Behaviour had active and enabled called?
gameObject
The game object this component is attached to. A component is always attached to a
game object.
tag
The tag of this game object.
transform
The Transform attached to this GameObject.
hideFlags
Should the object be hidden, saved with the Scene or modi able by the user?
name
The name of the object.
Public Methods
BroadcastMessage
Calls the method named methodName on every MonoBehaviour in this game
object or any of its children.
CompareTag
Is this game object tagged with tag ?
GetComponent
Returns the component of Type type if the game object has one attached, null if
it doesn't.
GetComponentInChildren
Returns the component of Type type in the GameObject or any of its children
using depth rst search.
GetComponentInParent
Returns the component of Type type in the GameObject or any of its parents.
GetComponents
Returns all components of Type type in the GameObject.
GetComponentsInChildren
Returns all components of Type type in the GameObject or any of its children.
GetComponentsInParent
Returns all components of Type type in the GameObject or any of its parents.
SendMessage
Calls the method named methodName on every MonoBehaviour in this game
object.
SendMessageUpwards
Calls the method named methodName on every MonoBehaviour in this game
object and on every ancestor of the behaviour.
GetInstanceID
Returns the instance id of the object.
ToString
Returns the name of the GameObject.
Static Methods
Destroy
Removes a gameobject, component or asset.
DestroyImmediate
Destroys the object obj immediately. You are strongly recommended to use Destroy
instead.
DontDestroyOnLoad
Makes the object target not be destroyed automatically when loading a new Scene.
FindObjectOfType
Returns the rst active loaded object of Type type.
FindObjectsOfType
Returns a list of all active loaded objects of Type type.
Instantiate
Clones the object original and returns the clone.
Operators
bool
Does the object exist?
operator !=
Compares if two objects refer to a di erent object.
operator ==
Compares two object references to see if they refer to the same object.
Leave feedback
Implements interfaces:IConstraint
Description
Constrains the rotation of an object relative to the rotation of one or more source objects.
Properties
constraintActive
Activates or deactivates the constraint.
locked
Locks the o set and rotation at rest.
rotationAtRest
The rotation used when the sources have a total weight of 0.
rotationAxis
The axes a ected by the RotationConstraint.
rotationO set
The o set from the constrained rotation.
sourceCount
The number of sources set on the component (read-only).
weight
The weight of the constraint component.
Public Methods
AddSource
Adds a constraint source.
GetSource
Gets a constraint source by index.
GetSources
Gets the list of sources.
RemoveSource
Removes a source from the component.
SetSource
Sets a source at a speci ed index.
SetSources
Sets the list of sources on the component.
Inherited Members
Properties
enabled
Enabled Behaviours are Updated, disabled Behaviours are not.
isActiveAndEnabled
Has the Behaviour had active and enabled called?
gameObject
The game object this component is attached to. A component is always attached to a
game object.
tag
The tag of this game object.
transform
The Transform attached to this GameObject.
hideFlags
Should the object be hidden, saved with the Scene or modi able by the user?
name
The name of the object.
Public Methods
BroadcastMessage
Calls the method named methodName on every MonoBehaviour in this game
object or any of its children.
CompareTag
Is this game object tagged with tag ?
GetComponent
Returns the component of Type type if the game object has one attached, null if
it doesn't.
GetComponentInChildren
Returns the component of Type type in the GameObject or any of its children
using depth rst search.
GetComponentInParent
Returns the component of Type type in the GameObject or any of its parents.
GetComponents
Returns all components of Type type in the GameObject.
GetComponentsInChildren
Returns all components of Type type in the GameObject or any of its children.
GetComponentsInParent
Returns all components of Type type in the GameObject or any of its parents.
SendMessage
Calls the method named methodName on every MonoBehaviour in this game
object.
SendMessageUpwards
Calls the method named methodName on every MonoBehaviour in this game
object and on every ancestor of the behaviour.
GetInstanceID
Returns the instance id of the object.
ToString
Returns the name of the GameObject.
Static Methods
Destroy
Removes a gameobject, component or asset.
DestroyImmediate
Destroys the object obj immediately. You are strongly recommended to use Destroy
instead.
DontDestroyOnLoad
Makes the object target not be destroyed automatically when loading a new Scene.
FindObjectOfType
Returns the rst active loaded object of Type type.
FindObjectsOfType
Returns a list of all active loaded objects of Type type.
Instantiate
Clones the object original and returns the clone.
Operators
bool
Does the object exist?
operator !=
Compares if two objects refer to a di erent object.
operator ==
Compares two object references to see if they refer to the same object.
Leave feedback
Implements interfaces:IConstraint
Description
Constrains the scale of an object relative to the scale of one or more source objects.
Properties
constraintActive
Activates or deactivates the constraint.
locked
Locks the o set and scale at rest.
scaleAtRest
The scale used when the sources have a total weight of 0.
scaleO set
The o set from the constrained scale.
scalingAxis
The axes a ected by the ScaleConstraint.
sourceCount
The number of sources set on the component (read-only).
weight
The weight of the constraint component.
Public Methods
AddSource
Adds a constraint source.
GetSource
Gets a constraint source by index.
GetSources
Gets the list of sources.
RemoveSource
Removes a source from the component.
SetSource
Sets a source at a speci ed index.
SetSources
Sets the list of sources on the component.
Inherited Members
Properties
enabled
Enabled Behaviours are Updated, disabled Behaviours are not.
isActiveAndEnabled
Has the Behaviour had active and enabled called?
gameObject
The game object this component is attached to. A component is always attached to a
game object.
tag
The tag of this game object.
transform
The Transform attached to this GameObject.
hideFlags
Should the object be hidden, saved with the Scene or modi able by the user?
name
The name of the object.
Public Methods
BroadcastMessage
Calls the method named methodName on every MonoBehaviour in this game
object or any of its children.
CompareTag
Is this game object tagged with tag ?
GetComponent
Returns the component of Type type if the game object has one attached, null if
it doesn't.
GetComponentInChildren
Returns the component of Type type in the GameObject or any of its children
using depth rst search.
GetComponentInParent
Returns the component of Type type in the GameObject or any of its parents.
GetComponents
Returns all components of Type type in the GameObject.
GetComponentsInChildren
Returns all components of Type type in the GameObject or any of its children.
GetComponentsInParent
Returns all components of Type type in the GameObject or any of its parents.
SendMessage
Calls the method named methodName on every MonoBehaviour in this game
object.
SendMessageUpwards
Calls the method named methodName on every MonoBehaviour in this game
object and on every ancestor of the behaviour.
GetInstanceID
Returns the instance id of the object.
ToString
Returns the name of the GameObject.
Static Methods
Destroy
Removes a gameobject, component or asset.
DestroyImmediate
Destroys the object obj immediately. You are strongly recommended to use Destroy
instead.
DontDestroyOnLoad
Makes the object target not be destroyed automatically when loading a new Scene.
FindObjectOfType
Returns the rst active loaded object of Type type.
FindObjectsOfType
Returns a list of all active loaded objects of Type type.
Instantiate
Clones the object original and returns the clone.
Operators
bool
Does the object exist?
operator !=
Compares if two objects refer to a di erent object.
operator ==
Compares two object references to see if they refer to the same object.
Leave feedback
Description
The common interface for constraint components.
Properties
constraintActive
Activate or deactivate the constraint.
locked
Lock or unlock the o set and position at rest.
sourceCount
Gets the number of sources currently set on the component.
weight
The weight of the constraint component.
Public Methods
AddSource
Add a constraint source.
GetSource
Gets a constraint source by index.
GetSources
Gets the list of sources.
RemoveSource
Removes a source from the component.
SetSource
Sets a source at a speci ed index.
SetSources
Sets the list of sources on the component.
Leave feedback
Description
Represents the axes used in 3D space.
Properties
None
Represents the case when no axis is speci ed.
X
Represents the X axis.
Y
Represents the Y axis.
Z
Represents the Z axis.
Leave feedback
Description
ReplayKit is only available on certain iPhone, iPad and iPod Touch devices running iOS 9.0 or later.
ReplayKit allows you to record the audio and video of your game, along with user commentary through the
microphone. Start a recording with the StartRecording() function, and stop it with StopRecording(). You can
preview the recording with the Preview() function, which launches a separate video viewer.
Note: The exact Apple devices which have support for ReplayKit are:
1. iPhone 5S or later
2. iPad mini 2 or later
3. iPod Touch 6th generation
4. iPad Air or later.
using System;
using UnityEngine;
#if PLATFORM_IOS
using UnityEngine.iOS;
using UnityEngine.Apple.ReplayKit;
public class Replay : MonoBehaviour
{
string lastError = "";
void OnGUI()
{
if (!ReplayKit.APIAvailable)
{
return;
}
var recording = ReplayKit.isRecording;
string caption = recording ? "Stop Recording" : "Start Recording";
if (GUI.Button(new Rect(10, 10, 500, 200), caption))
{
try
{
recording = !recording;
if (recording)
{
ReplayKit.StartRecording();
}
else
{
ReplayKit.StopRecording();
}
}
catch (Exception e)
{
lastError = e.ToString();
}
}
GUI.Label(new Rect(10, 220, 500, 50), "Last error: " + ReplayKit.lastErr
GUI.Label(new Rect(10, 280, 500, 50), "Last exception: " + lastError);
if (ReplayKit.recordingAvailable)
{
if (GUI.Button(new Rect(10, 350, 500, 200), "Preview"))
{
ReplayKit.Preview();
}
if (GUI.Button(new Rect(10, 560, 500, 200), "Discard"))
{
ReplayKit.Discard();
}
}
}
}
#endif
Static Properties
APIAvailable
A boolean that indicates whether the ReplayKit API is available (where True means
available). (Read Only)
broadcastingAPIAvailable
A Boolean that indicates whether ReplayKit broadcasting API is available (true
means available) (Read Only). Check the value of this property before making
ReplayKit broadcasting API calls. On iOS versions prior to iOS 10, this property will
have a value of false.
broadcastURL
A string property that contains an URL used to redirect the user to an on-going or
completed broadcast (Read Only).
cameraEnabled
Camera enabled status, true, if camera enabled, false otherwise.
isBroadcasting
Boolean property that indicates whether a broadcast is currently in progress
(Read Only).
isRecording
A boolean that indicates whether ReplayKit is making a recording (where True
means a recording is in progress). (Read Only)
lastError
A string value of the last error incurred by the ReplayKit: Either 'Failed to get
Screen Recorder' or 'No recording available'. (Read Only)
microphoneEnabled
Microphone enabled status, true, if microhone enabled, false otherwise.
recordingAvailable
A boolean value that indicates that a new recording is available for preview (where
True means available). (Read Only)
Static Methods
Discard
Discard the current recording.
HideCameraPreview
Hide the camera preview view.
Preview
Preview the current recording
ShowCameraPreviewAt
Shows camera preview at coordinates posX and posY.
StartBroadcasting
Initiates and starts a new broadcast When StartBroadcast is called, user is presented
with a broadcast provider selection screen, and then a broadcast setup screen.
Once it is nished, a broadcast will be started, and the callback will be invoked. It will
also be invoked in case of any error.
StartRecording
Start a new recording.
StopBroadcasting
Stops current broadcast. Will terminate currently on-going broadcast. If no
broadcast is in progress, does nothing.
StopRecording
Stop the current recording.
Delegates
BroadcastStatusCallback
Function called at the completion of broadcast startup.
Leave feedback
Description
A oat comparer used by Assert performing approximate comparison.
Static Properties
kEpsilon
Default epsilon used by the comparer.
s_ComparerWithDefaultTolerance
Default instance of a comparer class with deafult error epsilon and
absolute error check.
Constructors
FloatComparer
Creates an instance of the comparer.
Static Methods
AreEqual
Performs equality check with absolute error check.
AreEqualRelative
Performs equality check with relative error check.
Leave feedback
Obsolete
Description
An extension class that serves as a wrapper for the Assert class.
The MustExtension class wraps the Assertion.Assert into a more readable and shorter syntax.
using UnityEngine;
using UnityEngine.Assertions;
using UnityEngine.Assertions.Must;
public class ExampleClass : MonoBehaviour
{
public int health;
public GameObject go;
void Update()
{
//This assertion
Assert.AreNotEqual(0, health);
//can be also written like this
health.MustNotBeEqual(0);
//Same with this assertion
Assert.IsTrue(go.activeInHierarchy);
//can be also written like this
go.activeInHierarchy.MustBeTrue();
}
}
Leave feedback
Description
The Assert class contains assertion methods for setting invariants in the code.
All method calls will be conditionally included only in the development builds, unless explicitly speci ed (see
BuildOptions.ForceEnableAssertions). The inclusion of the assertions is controlled by UNITY_ASSERTIONS de ne.
A failure of an assertion method does not break the control ow of the execution. On a failure, an assertion
message is logged (LogType.Assert) and the execution continues. If Assert.raiseExceptions is set to true, an
AssertionException is thrown instead of logging a message.
If a debugger is attached to the project (System.Diagnostics.Debugger.IsAttached is true), AssertionException will
be thrown in order to pause the excecution and invoke the debugger.
using UnityEngine;
using UnityEngine.Assertions;
public class AssertionExampleClass : MonoBehaviour
{
public int health;
public GameObject go;
void Update()
{
// You expect the health never to be equal to zero
Assert.AreNotEqual(0, health);
// The referenced GameObject should be always (in every frame) be active
Assert.IsTrue(go.activeInHierarchy);
}
}
Static Properties
raiseExceptions
Whether Unity should throw an exception on a failure.
Static Methods
AreApproximatelyEqual
Asserts that the values are approximately equal. An absolute error check is used
for approximate equality check (|a-b| < tolerance). Default tolerance is
0.00001f.Note: Every time you call the method with tolerance speci ed, a new
instance of FloatComparer is created. For performance reasons you might want
to instance your own comparer and pass it to the AreEqual method. If the
tolerance is not speci es, a default comparer is used and the issue does not
occur.
AreEqual
Asserts that the values are equal. If no comparer is speci ed,
EqualityComparer.Default is used.
AreNotApproximatelyEqual
Asserts that the values are approximately not equal. An absolute error check is
used for approximate equality check (|a-b| < tolerance). Default tolerance is
0.00001f.
AreNotEqual
Asserts that the values are not equal.
IsFalse
Asserts that the condition is false.
IsNotNull
Asserts that the value is not null.
IsNull
Asserts that the value is null.
IsTrue
Asserts that the condition is true.
Leave feedback
Description
An exception that is thrown on a failure. Assert.raiseExceptions needs to be set to true.
Leave feedback
Implements interfaces:IPlayable
Description
An implementation of IPlayable that controls an AudioClip.
NOTE: You can use PlayableExtensions methods with AudioClipPlayable objects.
Static Methods
Create
Creates an AudioClipPlayable in the PlayableGraph.
Leave feedback
Description
AudioMixer asset.
This is a singleton representing a speci c audio mixer asset in the project.
Properties
outputAudioMixerGroup
Routing target.
updateMode
How time should progress for this AudioMixer. Used during Snapshot transitions.
Public Methods
ClearFloat
Resets an exposed parameter to its initial value.
FindMatchingGroups
Connected groups in the mixer form a path from the mixer's master group to the
leaves. This path has the format "Master Group/Child of Master Group/Grandchild of
Master Group", so to nd the grandchild group in this example, a valid search string
would be for instance "randchi" which would return exactly one group while "hild" or
"oup/" would return 2 di erent groups.
FindSnapshot
The name must be an exact match.
GetFloat
Returns the value of the exposed parameter speci ed. If the parameter doesn't exist
the function returns false. Prior to calling SetFloat and after ClearFloat has been
called on this parameter the value returned will be that of the current snapshot or
snapshot transition.
SetFloat
Sets the value of the exposed parameter speci ed. When a parameter is exposed, it
is not controlled by mixer snapshots and can therefore only be changed via this
function.
TransitionToSnapshots
Transitions to a weighted mixture of the snapshots speci ed. This can be used for
games that specify the game state as a continuum between states or for
interpolating snapshots from a triangulated map location.
Inherited Members
Properties
hideFlags
Should the object be hidden, saved with the Scene or modi able by the user?
name
The name of the object.
Public Methods
GetInstanceID
Returns the instance id of the object.
ToString
Returns the name of the GameObject.
Static Methods
Destroy
Removes a gameobject, component or asset.
DestroyImmediate
Destroys the object obj immediately. You are strongly recommended to use Destroy
instead.
DontDestroyOnLoad
Makes the object target not be destroyed automatically when loading a new Scene.
FindObjectOfType
Returns the rst active loaded object of Type type.
FindObjectsOfType
Returns a list of all active loaded objects of Type type.
Instantiate
Clones the object original and returns the clone.
Operators
bool
Does the object exist?
operator !=
Compares if two objects refer to a di erent object.
operator ==
Compares two object references to see if they refer to the same object.
Leave feedback
Description
Object representing a group in the mixer.
Inherited Members
Properties
hideFlags
Should the object be hidden, saved with the Scene or modi able by the user?
name
The name of the object.
Public Methods
GetInstanceID
Returns the instance id of the object.
ToString
Returns the name of the GameObject.
Static Methods
Destroy
Removes a gameobject, component or asset.
DestroyImmediate
Destroys the object obj immediately. You are strongly recommended to use Destroy
instead.
DontDestroyOnLoad
Makes the object target not be destroyed automatically when loading a new Scene.
FindObjectOfType
Returns the rst active loaded object of Type type.
FindObjectsOfType
Returns a list of all active loaded objects of Type type.
Instantiate
Clones the object original and returns the clone.
Operators
bool
Does the object exist?
operator !=
Compares if two objects refer to a di erent object.
operator ==
Compares two object references to see if they refer to the same object.
Leave feedback
Implements interfaces:IPlayable
Description
An implementation of IPlayable that controls an audio mixer.
NOTE: You can use PlayableExtensions methods with AudioMixerPlayable objects.
Leave feedback
Description
Object representing a snapshot in the mixer.
Public Methods
TransitionTo
Performs an interpolated transition towards this snapshot over the time interval speci ed.
Inherited Members
Properties
hideFlags
Should the object be hidden, saved with the Scene or modi able by the user?
name
The name of the object.
Public Methods
GetInstanceID
Returns the instance id of the object.
ToString
Returns the name of the GameObject.
Static Methods
Destroy
Removes a gameobject, component or asset.
DestroyImmediate
Destroys the object obj immediately. You are strongly recommended to use Destroy
instead.
DontDestroyOnLoad
Makes the object target not be destroyed automatically when loading a new Scene.
FindObjectOfType
Returns the rst active loaded object of Type type.
FindObjectsOfType
Returns a list of all active loaded objects of Type type.
Instantiate
Clones the object original and returns the clone.
Operators
bool
Does the object exist?
operator !=
Compares if two objects refer to a di erent object.
operator ==
Compares two object references to see if they refer to the same object.
Leave feedback
Description
A PlayableBinding that contains information representing an AudioPlayableOutput.
Static Methods
Create
Creates a PlayableBinding that contains information representing an
AudioPlayableOutput.
Leave feedback
Implements interfaces:IPlayableOutput
Description
A IPlayableOutput implementation that will be used to play audio.
NOTE: You can use PlayableOutputExtensions methods with AudioPlayableOutput objects.
Static Properties
Null
Returns an invalid AudioPlayableOutput.
Public Methods
GetEvaluateOnSeek
Gets the state of output playback when seeking.
SetEvaluateOnSeek
Controls whether the output should play when seeking.
Static Methods
Create
Creates an AudioPlayableOutput in the PlayableGraph.
Leave feedback
Description
The mode in which an AudioMixer should update its time.
Use this with AudioMixer.updateMode to de ne how the AudioMixer time is updated.
Properties
Normal
Update the AudioMixer with scaled game time.
UnscaledTime
Update the AudioMixer with unscaled realtime.
Leave feedback
Description
Engine API for CrashReporting Service.
Static Properties
enableCaptureExceptions
This Boolean eld will cause CrashReportHandler to capture exceptions when set
to true. By default enable capture exceptions is true.
logBu erSize
The Performance Reporting service will keep a bu er of up to the last X log
messages (Debug.Log, etc) to send along with crash reports. The default is 10 log
messages, the max is 50. Set this to 0 to disable capture of logs with your crash
reports.
Static Methods
GetUserMetadata
Get a custom crash report metadata eld that has been set.
SetUserMetadata
Set a custom metadata key-value pair to be included with crash reports.
Leave feedback
Description
A zero argument persistent callback that can be saved with the Scene.
using UnityEngine;
using UnityEngine.Events;
using System.Collections;
public class ExampleClass : MonoBehaviour
{
UnityEvent m_MyEvent;
void Start()
{
if (m_MyEvent == null)
m_MyEvent = new UnityEvent();
m_MyEvent.AddListener(Ping);
}
void Update()
{
if (Input.anyKeyDown && m_MyEvent != null)
{
m_MyEvent.Invoke();
}
}
void Ping()
{
Debug.Log("Ping");
}
}
Constructors
UnityEvent
Constructor.
Public Methods
AddListener
Add a non persistent listener to the UnityEvent.
Invoke
Invoke all registered callbacks (runtime and persistent).
RemoveListener
Remove a non persistent listener from the UnityEvent.
Inherited Members
Public Methods
GetPersistentEventCount
Get the number of registered persistent listeners.
GetPersistentMethodName
Get the target method name of the listener at index index.
GetPersistentTarget
Get the target component of the listener at index index.
RemoveAllListeners
Remove all non-persisent (ie created from script) listeners from the event.
SetPersistentListenerState
Modify the execution state of a persistent listener.
Static Methods
GetValidMethodInfo
Given an object, function name, and a list of argument types; nd the method that
matches.
Leave feedback
Description
One argument version of UnityEvent.
If you wish to use a generic UnityEvent type you must override the class type.
using UnityEngine;
using UnityEngine.Events;
[System.Serializable]
public class MyIntEvent : UnityEvent
{
}
public class ExampleClass : MonoBehaviour
{
public MyIntEvent m_MyEvent;
void Start()
{
if (m_MyEvent == null)
m_MyEvent = new MyIntEvent();
m_MyEvent.AddListener(Ping);
}
void Update()
{
if (Input.anyKeyDown && m_MyEvent != null)
{
m_MyEvent.Invoke(5);
}
}
void Ping(int i)
{
Debug.Log("Ping" + i);
}
}
Inherited Members
Public Methods
GetPersistentEventCount
Get the number of registered persistent listeners.
GetPersistentMethodName
Get the target method name of the listener at index index.
GetPersistentTarget
Get the target component of the listener at index index.
RemoveAllListeners
Remove all non-persisent (ie created from script) listeners from the event.
SetPersistentListenerState
Modify the execution state of a persistent listener.
Static Methods
GetValidMethodInfo
Given an object, function name, and a list of argument types; nd the method that
matches.
Leave feedback
Description
Two argument version of UnityEvent.
If you wish to use a generic UnityEvent type you must override the class type.
using UnityEngine;
using UnityEngine.Events;
[System.Serializable]
public class MyIntEvent : UnityEvent
{
}
public class ExampleClass : MonoBehaviour
{
public MyIntEvent m_MyEvent;
void Start()
{
if (m_MyEvent == null)
m_MyEvent = new MyIntEvent();
m_MyEvent.AddListener(Ping);
}
void Update()
{
if (Input.anyKeyDown && m_MyEvent != null)
{
m_MyEvent.Invoke(5, 6);
}
}
void Ping(int i, int j)
{
Debug.Log("Ping" + i + ", " + j);
}
}
Inherited Members
Public Methods
GetPersistentEventCount
Get the number of registered persistent listeners.
GetPersistentMethodName
Get the target method name of the listener at index index.
GetPersistentTarget
Get the target component of the listener at index index.
RemoveAllListeners
Remove all non-persisent (ie created from script) listeners from the event.
SetPersistentListenerState
Modify the execution state of a persistent listener.
Static Methods
GetValidMethodInfo
Given an object, function name, and a list of argument types; nd the method that
matches.
Leave feedback
Description
Three argument version of UnityEvent.
If you wish to use a generic UnityEvent type you must override the class type.
using UnityEngine;
using UnityEngine.Events;
[System.Serializable]
public class MyIntEvent : UnityEvent
{
}
public class ExampleClass : MonoBehaviour
{
public MyIntEvent m_MyEvent;
void Start()
{
if (m_MyEvent == null)
m_MyEvent = new MyIntEvent();
m_MyEvent.AddListener(Ping);
}
void Update()
{
if (Input.anyKeyDown && m_MyEvent != null)
{
m_MyEvent.Invoke(5, 6, 7);
}
}
void Ping(int i, int j, int k)
{
Debug.Log("Ping" + i + j + k);
}
}
Inherited Members
Public Methods
GetPersistentEventCount
Get the number of registered persistent listeners.
GetPersistentMethodName
Get the target method name of the listener at index index.
GetPersistentTarget
Get the target component of the listener at index index.
RemoveAllListeners
Remove all non-persisent (ie created from script) listeners from the event.
SetPersistentListenerState
Modify the execution state of a persistent listener.
Static Methods
GetValidMethodInfo
Given an object, function name, and a list of argument types; nd the method that
matches.
Leave feedback
Description
Four argument version of UnityEvent.
If you wish to use a generic UnityEvent type you must override the class type.
using UnityEngine;
using UnityEngine.Events;
[System.Serializable]
public class MyIntEvent : UnityEvent
{
}
public class ExampleClass : MonoBehaviour
{
public MyIntEvent m_MyEvent;
void Start()
{
if (m_MyEvent == null)
m_MyEvent = new MyIntEvent();
m_MyEvent.AddListener(Ping);
}
void Update()
{
if (Input.anyKeyDown && m_MyEvent != null)
{
m_MyEvent.Invoke(5, 6, 7, 8);
}
}
void Ping(int i, int j, int k, int l)
{
Debug.Log("Ping" + i + j + k + l);
}
}
Inherited Members
Public Methods
GetPersistentEventCount
Get the number of registered persistent listeners.
GetPersistentMethodName
Get the target method name of the listener at index index.
GetPersistentTarget
Get the target component of the listener at index index.
RemoveAllListeners
Remove all non-persisent (ie created from script) listeners from the event.
SetPersistentListenerState
Modify the execution state of a persistent listener.
Static Methods
GetValidMethodInfo
Given an object, function name, and a list of argument types; nd the method that
matches.
Leave feedback
Implements interfaces:ISerializationCallbackReceiver
Description
Abstract base class for UnityEvents.
This class provides the base functionality for the UnityEvents.
Public Methods
GetPersistentEventCount
Get the number of registered persistent listeners.
GetPersistentMethodName
Get the target method name of the listener at index index.
GetPersistentTarget
Get the target component of the listener at index index.
RemoveAllListeners
Remove all non-persisent (ie created from script) listeners from the event.
SetPersistentListenerState
Modify the execution state of a persistent listener.
Static Methods
GetValidMethodInfo
Given an object, function name, and a list of argument types; nd the method that
matches.
Leave feedback
Description
THe mode that a listener is operating in.
Properties
EventDe ned
The listener will use the function binding speci ed by the even.
Void
The listener will bind to zero argument functions.
Object
The listener will bind to one argument Object functions.
Int
The listener will bind to one argument int functions.
Float
The listener will bind to one argument oat functions.
String
The listener will bind to one argument string functions.
Bool
The listener will bind to one argument bool functions.
Leave feedback
Description
Controls the scope of UnityEvent callbacks.
Properties
O
Callback is not issued.
EditorAndRuntime
Callback is always issued.
RuntimeOnly
Callback is only issued in the Runtime and Editor playmode.
Leave feedback
Description
A class that can be used for sending simple events via the event system.
Properties
used
Is the event used?
Public Methods
Reset
Reset the event.
Use
Use the event.
Leave feedback
Description
Event Data associated with Axis Events (Controller / Keyboard).
See Also: BaseEventData.
Properties
moveDir
MoveDirection for this event.
moveVector
Raw input vector associated with this event.
Inherited Members
Properties
used
Is the event used?
currentInputModule
A reference to the BaseInputModule that sent this event.
selectedObject
The object currently considered selected by the EventSystem.
Public Methods
Reset
Reset the event.
Use
Use the event.
Leave feedback
Description
A class that contains the base event data that is common to all event types in the new EventSystem.
Properties
currentInputModule
A reference to the BaseInputModule that sent this event.
selectedObject
The object currently considered selected by the EventSystem.
Constructors
BaseEventData
Construct a BaseEventData tied to the passed EventSystem.
Inherited Members
Properties
used
Is the event used?
Public Methods
Reset
Reset the event.
Use
Use the event.
Leave feedback
Description
Interface to the Input system used by the BaseInputModule. With this it is possible to bypass the Input system
with your own but still use the same InputModule. For example this can be used to feed fake input into the UI or
interface with a di erent input system.
Properties
compositionCursorPos
Interface to Input.compositionCursorPos. Can be overridden to provide custom
input instead of using the Input class.
compositionString
Interface to Input.compositionString. Can be overridden to provide custom input
instead of using the Input class.
imeCompositionMode
Interface to Input.imeCompositionMode. Can be overridden to provide custom input
instead of using the Input class.
mousePosition
Interface to Input.mousePosition. Can be overridden to provide custom input
instead of using the Input class.
mousePresent
Interface to Input.mousePresent. Can be overridden to provide custom input instead
of using the Input class.
mouseScrollDelta
Interface to Input.mouseScrollDelta. Can be overridden to provide custom input
instead of using the Input class.
touchCount
Interface to Input.touchCount. Can be overridden to provide custom input instead of
using the Input class.
touchSupported
Interface to Input.touchSupported. Can be overridden to provide custom input
instead of using the Input class.
Public Methods
GetAxisRaw
Interface to Input.GetAxisRaw. Can be overridden to provide custom input instead of
using the Input class.
GetButtonDown
Interface to Input.GetButtonDown. Can be overridden to provide custom input
instead of using the Input class.
GetMouseButton
Interface to Input.GetMouseButton. Can be overridden to provide custom input
instead of using the Input class.
GetMouseButtonDown
Interface to Input.GetMouseButtonDown. Can be overridden to provide custom
input instead of using the Input class.
GetMouseButtonUp
Interface to Input.GetMouseButtonUp. Can be overridden to provide custom input
instead of using the Input class.
GetTouch
Interface to Input.GetTouch. Can be overridden to provide custom input instead of
using the Input class.
Inherited Members
Properties
enabled
Enabled Behaviours are Updated, disabled Behaviours are not.
isActiveAndEnabled
Has the Behaviour had active and enabled called?
gameObject
The game object this component is attached to. A component is always attached to a
game object.
tag
The tag of this game object.
transform
The Transform attached to this GameObject.
runInEditMode
Allow a speci c instance of a MonoBehaviour to run in edit mode (only available in the
editor).
useGUILayout
Disabling this lets you skip the GUI layout phase.
hideFlags
Should the object be hidden, saved with the Scene or modi able by the user?
name
The name of the object.
Public Methods
BroadcastMessage
Calls the method named methodName on every MonoBehaviour in this game
object or any of its children.
CompareTag
Is this game object tagged with tag ?
GetComponent
Returns the component of Type type if the game object has one attached, null if
it doesn't.
GetComponentInChildren
Returns the component of Type type in the GameObject or any of its children
using depth rst search.
GetComponentInParent
Returns the component of Type type in the GameObject or any of its parents.
GetComponents
Returns all components of Type type in the GameObject.
GetComponentsInChildren
Returns all components of Type type in the GameObject or any of its children.
GetComponentsInParent
Returns all components of Type type in the GameObject or any of its parents.
SendMessage
Calls the method named methodName on every MonoBehaviour in this game
object.
SendMessageUpwards
Calls the method named methodName on every MonoBehaviour in this game
object and on every ancestor of the behaviour.
CancelInvoke
Cancels all Invoke calls on this MonoBehaviour.
Invoke
Invokes the method methodName in time seconds.
InvokeRepeating
Invokes the method methodName in time seconds, then repeatedly every
repeatRate seconds.
IsInvoking
Is any invoke on methodName pending?
StartCoroutine
Starts a coroutine.
StopAllCoroutines
Stops all coroutines running on this behaviour.
StopCoroutine
Stops the rst coroutine named methodName, or the coroutine stored in routine
running on this behaviour.
GetInstanceID
Returns the instance id of the object.
ToString
Returns the name of the GameObject.
IsActive
Returns true if the GameObject and the Component are active.
IsDestroyed
Returns true if the native representation of the behaviour has been destroyed.
Protected Methods
Awake
See MonoBehaviour.Awake.
OnBeforeTransformParentChanged
See MonoBehaviour.OnBeforeTransformParentChanged.
OnCanvasGroupChanged
See MonoBehaviour.OnCanvasGroupChanged.
OnCanvasHierarchyChanged
Called when the state of the parent Canvas is changed.
OnDestroy
See MonoBehaviour.OnDestroy.
OnDidApplyAnimationProperties
See LayoutGroup.OnDidApplyAnimationProperties.
OnDisable
See MonoBehaviour.OnDisable.
OnEnable
See MonoBehaviour.OnEnable.
OnRectTransformDimensionsChange
This callback is called if an associated RectTransform has its
dimensions changed.
OnTransformParentChanged
See MonoBehaviour.OnRectTransformParentChanged.
OnValidate
See MonoBehaviour.OnValidate.
Reset
See MonoBehaviour.Reset.
Start
See MonoBehaviour.Start.
Static Methods
print
Logs message to the Unity Console (identical to Debug.Log).
Destroy
Removes a gameobject, component or asset.
DestroyImmediate
Destroys the object obj immediately. You are strongly recommended to use Destroy
instead.
DontDestroyOnLoad
Makes the object target not be destroyed automatically when loading a new Scene.
FindObjectOfType
Returns the rst active loaded object of Type type.
FindObjectsOfType
Returns a list of all active loaded objects of Type type.
Instantiate
Clones the object original and returns the clone.
Operators
bool
Does the object exist?
operator !=
Compares if two objects refer to a di erent object.
operator ==
Compares two object references to see if they refer to the same object.
Messages
Awake
Awake is called when the script instance is being loaded.
FixedUpdate
This function is called every xed framerate frame, if the
MonoBehaviour is enabled.
LateUpdate
LateUpdate is called every frame, if the Behaviour is enabled.
OnAnimatorIK
Callback for setting up animation IK (inverse kinematics).
OnAnimatorMove
Callback for processing animation movements for modifying root
motion.
OnApplicationFocus
Sent to all GameObjects when the player gets or loses focus.
OnApplicationPause
Sent to all GameObjects when the application pauses.
OnApplicationQuit
Sent to all game objects before the application quits.
OnAudioFilterRead
If OnAudioFilterRead is implemented, Unity will insert a custom lter
into the audio DSP chain.
OnBecameInvisible
OnBecameInvisible is called when the renderer is no longer visible by
any camera.
OnBecameVisible
OnBecameVisible is called when the renderer became visible by any
camera.
OnCollisionEnter
OnCollisionEnter is called when this collider/rigidbody has begun
touching another rigidbody/collider.
OnCollisionEnter2D
Sent when an incoming collider makes contact with this object's collider
(2D physics only).
OnCollisionExit
OnCollisionExit is called when this collider/rigidbody has stopped
touching another rigidbody/collider.
OnCollisionExit2D
Sent when a collider on another object stops touching this object's
collider (2D physics only).
OnCollisionStay
:ref::OnCollisionStay is called once per frame for every
collider/rigidbody that is touching rigidbody/collider.
OnCollisionStay2D
Sent each frame where a collider on another object is touching this
object's collider (2D physics only).
OnConnectedToServer
Called on the client when you have successfully connected to a server.
OnControllerColliderHit
OnControllerColliderHit is called when the controller hits a collider while
performing a Move.
OnDestroy
Destroying the attached Behaviour will result in the game or Scene
receiving OnDestroy.
OnDisable
This function is called when the behaviour becomes disabled.
OnDisconnectedFromServer
Called on the client when the connection was lost or you disconnected
from the server.
OnDrawGizmos
Implement OnDrawGizmos if you want to draw gizmos that are also
pickable and always drawn.
OnDrawGizmosSelected
Implement OnDrawGizmosSelected to draw a gizmo if the object is
selected.
OnEnable
This function is called when the object becomes enabled and active.
OnFailedToConnect
Called on the client when a connection attempt fails for some reason.
OnFailedToConnectToMasterServer
Called on clients or servers when there is a problem connecting to the
MasterServer.
OnGUI
OnGUI is called for rendering and handling GUI events.
OnJointBreak
Called when a joint attached to the same game object broke.
OnJointBreak2D
Called when a Joint2D attached to the same game object breaks.
OnMasterServerEvent
Called on clients or servers when reporting events from the
MasterServer.
OnMouseDown
OnMouseDown is called when the user has pressed the mouse button
while over the GUIElement or Collider.
OnMouseDrag
OnMouseDrag is called when the user has clicked on a GUIElement or
Collider and is still holding down the mouse.
OnMouseEnter
Called when the mouse enters the GUIElement or Collider.
OnMouseExit
Called when the mouse is not any longer over the GUIElement or
Collider.
OnMouseOver
Called every frame while the mouse is over the GUIElement or Collider.
OnMouseUp
OnMouseUp is called when the user has released the mouse button.
OnMouseUpAsButton
OnMouseUpAsButton is only called when the mouse is released over
the same GUIElement or Collider as it was pressed.
OnNetworkInstantiate
Called on objects which have been network instantiated with
Network.Instantiate.
OnParticleCollision
OnParticleCollision is called when a particle hits a Collider.
OnParticleSystemStopped
OnParticleSystemStopped is called when all particles in the system have
died, and no new particles will be born. New particles cease to be
created either after Stop is called, or when the duration property of a
non-looping system has been exceeded.
OnParticleTrigger
OnParticleTrigger is called when any particles in a particle system meet
the conditions in the trigger module.
OnPlayerConnected
Called on the server whenever a new player has successfully connected.
OnPlayerDisconnected
Called on the server whenever a player disconnected from the server.
OnPostRender
OnPostRender is called after a camera nished rendering the Scene.
OnPreCull
OnPreCull is called before a camera culls the Scene.
OnPreRender
OnPreRender is called before a camera starts rendering the Scene.
OnRenderImage
OnRenderImage is called after all rendering is complete to render
image.
OnRenderObject
OnRenderObject is called after camera has rendered the Scene.
OnSerializeNetworkView
Used to customize synchronization of variables in a script watched by a
network view.
OnServerInitialized
Called on the server whenever a Network.InitializeServer was invoked
and has completed.
OnTransformChildrenChanged
This function is called when the list of children of the transform of the
GameObject has changed.
OnTransformParentChanged
This function is called when the parent property of the transform of the
GameObject has changed.
OnTriggerEnter
OnTriggerEnter is called when the Collider other enters the trigger.
OnTriggerEnter2D
Sent when another object enters a trigger collider attached to this
object (2D physics only).
OnTriggerExit
OnTriggerExit is called when the Collider other has stopped touching
the trigger.
OnTriggerExit2D
Sent when another object leaves a trigger collider attached to this
object (2D physics only).
OnTriggerStay
OnTriggerStay is called once per physics update for every Collider other
that is touching the trigger.
OnTriggerStay2D
Sent each frame where another object is within a trigger collider
attached to this object (2D physics only).
OnValidate
This function is called when the script is loaded or a value is changed in
the inspector (Called in the editor only).
OnWillRenderObject
OnWillRenderObject is called for each camera if the object is visible and
not a UI element.
Reset
Reset to default values.
Start
Start is called on the frame when a script is enabled just before any of
the Update methods are called the rst time.
Update
Update is called every frame, if the MonoBehaviour is enabled.
Leave feedback
Description
A base module that raises events and sends them to GameObjects.
An Input Module is a component of the EventSystem that is responsible for raising events and sending them to
GameObjects for handling. The BaseInputModule is a class that all Input Modules in the EventSystem inherit
from. Examples of provided modules are TouchInputModule and StandaloneInputModule, if these are inadequate
for your project you can create your own by extending from the BaseInputModule.
using UnityEngine;
using UnityEngine.EventSystems;
// Create a module that every tick sends a 'Move' event to
// the target object
public class MyInputModule : BaseInputModule
{
public GameObject m_TargetObject;
public override void Process()
{
if (m_TargetObject == null)
return;
ExecuteEvents.Execute(m_TargetObject, new BaseEventData(eventSystem), Ex
}
}
Properties
input
The current BaseInput being used by the input module.
inputOverride
Used to override the default BaseInput for the input module.
Public Methods
ActivateModule
Called when the module is activated. Override this if you want custom code to
execute when you activate your module.
DeactivateModule
Called when the module is deactivated. Override this if you want custom code to
execute when you deactivate your module.
IsModuleSupported
Check to see if the module is supported. Override this if you have a platfrom
speci c module (eg. TouchInputModule that you do not want to activate on
standalone.
IsPointerOverGameObject
Is the pointer with the given ID over an EventSystem object?
Process
Process the current tick for the module.
ShouldActivateModule
Should be activated.
UpdateModule
Update the internal state of the Module.
Protected Methods
GetAxisEventData
Given some input data generate an AxisEventData that can be used by the event
system.
GetBaseEventData
Generate a BaseEventData that can be used by the EventSystem.
HandlePointerExitAndEnter
Handle sending enter and exit events when a new enter target is found.
OnDisable
See MonoBehaviour.OnDisable.
OnEnable
See MonoBehaviour.OnEnable.
Static Methods
DetermineMoveDirection
Given an input movement, determine the best MoveDirection.
FindCommonRoot
Given 2 GameObjects, return a common root GameObject (or null).
FindFirstRaycast
Return the rst valid RaycastResult.
Inherited Members
Properties
enabled
Enabled Behaviours are Updated, disabled Behaviours are not.
isActiveAndEnabled
Has the Behaviour had active and enabled called?
gameObject
The game object this component is attached to. A component is always attached to a
game object.
tag
The tag of this game object.
transform
The Transform attached to this GameObject.
runInEditMode
Allow a speci c instance of a MonoBehaviour to run in edit mode (only available in the
editor).
useGUILayout
Disabling this lets you skip the GUI layout phase.
hideFlags
Should the object be hidden, saved with the Scene or modi able by the user?
name
The name of the object.
Public Methods
BroadcastMessage
Calls the method named methodName on every MonoBehaviour in this game
object or any of its children.
CompareTag
Is this game object tagged with tag ?
GetComponent
Returns the component of Type type if the game object has one attached, null if
it doesn't.
GetComponentInChildren
Returns the component of Type type in the GameObject or any of its children
using depth rst search.
GetComponentInParent
Returns the component of Type type in the GameObject or any of its parents.
GetComponents
Returns all components of Type type in the GameObject.
GetComponentsInChildren
Returns all components of Type type in the GameObject or any of its children.
GetComponentsInParent
Returns all components of Type type in the GameObject or any of its parents.
SendMessage
Calls the method named methodName on every MonoBehaviour in this game
object.
SendMessageUpwards
Calls the method named methodName on every MonoBehaviour in this game
object and on every ancestor of the behaviour.
CancelInvoke
Cancels all Invoke calls on this MonoBehaviour.
Invoke
Invokes the method methodName in time seconds.
InvokeRepeating
Invokes the method methodName in time seconds, then repeatedly every
repeatRate seconds.
IsInvoking
Is any invoke on methodName pending?
StartCoroutine
Starts a coroutine.
StopAllCoroutines
Stops all coroutines running on this behaviour.
StopCoroutine
Stops the rst coroutine named methodName, or the coroutine stored in routine
running on this behaviour.
GetInstanceID
Returns the instance id of the object.
ToString
Returns the name of the GameObject.
IsActive
Returns true if the GameObject and the Component are active.
IsDestroyed
Returns true if the native representation of the behaviour has been destroyed.
Protected Methods
Awake
See MonoBehaviour.Awake.
OnBeforeTransformParentChanged
See MonoBehaviour.OnBeforeTransformParentChanged.
OnCanvasGroupChanged
See MonoBehaviour.OnCanvasGroupChanged.
OnCanvasHierarchyChanged
Called when the state of the parent Canvas is changed.
OnDestroy
See MonoBehaviour.OnDestroy.
OnDidApplyAnimationProperties
See LayoutGroup.OnDidApplyAnimationProperties.
OnRectTransformDimensionsChange
This callback is called if an associated RectTransform has its
dimensions changed.
OnTransformParentChanged
See MonoBehaviour.OnRectTransformParentChanged.
OnValidate
See MonoBehaviour.OnValidate.
Reset
See MonoBehaviour.Reset.
Start
See MonoBehaviour.Start.
Static Methods
print
Logs message to the Unity Console (identical to Debug.Log).
Destroy
Removes a gameobject, component or asset.
DestroyImmediate
Destroys the object obj immediately. You are strongly recommended to use Destroy
instead.
DontDestroyOnLoad
Makes the object target not be destroyed automatically when loading a new Scene.
FindObjectOfType
Returns the rst active loaded object of Type type.
FindObjectsOfType
Returns a list of all active loaded objects of Type type.
Instantiate
Clones the object original and returns the clone.
Operators
bool
Does the object exist?
operator !=
Compares if two objects refer to a di erent object.
operator ==
Compares two object references to see if they refer to the same object.
Messages
Awake
Awake is called when the script instance is being loaded.
FixedUpdate
This function is called every xed framerate frame, if the
MonoBehaviour is enabled.
LateUpdate
LateUpdate is called every frame, if the Behaviour is enabled.
OnAnimatorIK
Callback for setting up animation IK (inverse kinematics).
OnAnimatorMove
Callback for processing animation movements for modifying root
motion.
OnApplicationFocus
Sent to all GameObjects when the player gets or loses focus.
OnApplicationPause
Sent to all GameObjects when the application pauses.
OnApplicationQuit
Sent to all game objects before the application quits.
OnAudioFilterRead
If OnAudioFilterRead is implemented, Unity will insert a custom lter
into the audio DSP chain.
OnBecameInvisible
OnBecameInvisible is called when the renderer is no longer visible by
any camera.
OnBecameVisible
OnBecameVisible is called when the renderer became visible by any
camera.
OnCollisionEnter
OnCollisionEnter is called when this collider/rigidbody has begun
touching another rigidbody/collider.
OnCollisionEnter2D
Sent when an incoming collider makes contact with this object's collider
(2D physics only).
OnCollisionExit
OnCollisionExit is called when this collider/rigidbody has stopped
touching another rigidbody/collider.
OnCollisionExit2D
Sent when a collider on another object stops touching this object's
collider (2D physics only).
OnCollisionStay
:ref::OnCollisionStay is called once per frame for every
collider/rigidbody that is touching rigidbody/collider.
OnCollisionStay2D
Sent each frame where a collider on another object is touching this
object's collider (2D physics only).
OnConnectedToServer
Called on the client when you have successfully connected to a server.
OnControllerColliderHit
OnControllerColliderHit is called when the controller hits a collider while
performing a Move.
OnDestroy
Destroying the attached Behaviour will result in the game or Scene
receiving OnDestroy.
OnDisconnectedFromServer
Called on the client when the connection was lost or you disconnected
from the server.
OnDrawGizmos
Implement OnDrawGizmos if you want to draw gizmos that are also
pickable and always drawn.
OnDrawGizmosSelected
Implement OnDrawGizmosSelected to draw a gizmo if the object is
selected.
OnFailedToConnect
Called on the client when a connection attempt fails for some reason.
OnFailedToConnectToMasterServer
Called on clients or servers when there is a problem connecting to the
MasterServer.
OnGUI
OnGUI is called for rendering and handling GUI events.
OnJointBreak
Called when a joint attached to the same game object broke.
OnJointBreak2D
Called when a Joint2D attached to the same game object breaks.
OnMasterServerEvent
Called on clients or servers when reporting events from the
MasterServer.
OnMouseDown
OnMouseDown is called when the user has pressed the mouse button
while over the GUIElement or Collider.
OnMouseDrag
OnMouseDrag is called when the user has clicked on a GUIElement or
Collider and is still holding down the mouse.
OnMouseEnter
Called when the mouse enters the GUIElement or Collider.
OnMouseExit
Called when the mouse is not any longer over the GUIElement or
Collider.
OnMouseOver
Called every frame while the mouse is over the GUIElement or Collider.
OnMouseUp
OnMouseUp is called when the user has released the mouse button.
OnMouseUpAsButton
OnMouseUpAsButton is only called when the mouse is released over
the same GUIElement or Collider as it was pressed.
OnNetworkInstantiate
Called on objects which have been network instantiated with
Network.Instantiate.
OnParticleCollision
OnParticleCollision is called when a particle hits a Collider.
OnParticleSystemStopped
OnParticleSystemStopped is called when all particles in the system have
died, and no new particles will be born. New particles cease to be
created either after Stop is called, or when the duration property of a
non-looping system has been exceeded.
OnParticleTrigger
OnParticleTrigger is called when any particles in a particle system meet
the conditions in the trigger module.
OnPlayerConnected
Called on the server whenever a new player has successfully connected.
OnPlayerDisconnected
Called on the server whenever a player disconnected from the server.
OnPostRender
OnPostRender is called after a camera nished rendering the Scene.
OnPreCull
OnPreCull is called before a camera culls the Scene.
OnPreRender
OnPreRender is called before a camera starts rendering the Scene.
OnRenderImage
OnRenderImage is called after all rendering is complete to render
image.
OnRenderObject
OnRenderObject is called after camera has rendered the Scene.
OnSerializeNetworkView
Used to customize synchronization of variables in a script watched by a
network view.
OnServerInitialized
Called on the server whenever a Network.InitializeServer was invoked
and has completed.
OnTransformChildrenChanged
This function is called when the list of children of the transform of the
GameObject has changed.
OnTransformParentChanged
This function is called when the parent property of the transform of the
GameObject has changed.
OnTriggerEnter
OnTriggerEnter is called when the Collider other enters the trigger.
OnTriggerEnter2D
Sent when another object enters a trigger collider attached to this
object (2D physics only).
OnTriggerExit
OnTriggerExit is called when the Collider other has stopped touching
the trigger.
OnTriggerExit2D
Sent when another object leaves a trigger collider attached to this
object (2D physics only).
OnTriggerStay
OnTriggerStay is called once per physics update for every Collider other
that is touching the trigger.
OnTriggerStay2D
Sent each frame where another object is within a trigger collider
attached to this object (2D physics only).
OnValidate
This function is called when the script is loaded or a value is changed in
the inspector (Called in the editor only).
OnWillRenderObject
OnWillRenderObject is called for each camera if the object is visible and
not a UI element.
Reset
Reset to default values.
Start
Start is called on the frame when a script is enabled just before any of
the Update methods are called the rst time.
Update
Update is called every frame, if the MonoBehaviour is enabled.
Leave feedback
Description
Base class for any RayCaster.
A Raycaster is responsible for raycasting against Scene elements to determine if the cursor is over them. Default
Raycasters include PhysicsRaycaster, Physics2DRaycaster, GraphicRaycaster.
Custom raycasters can be added by extending this class.
Properties
eventCamera
The camera that will generate rays for this raycaster.
renderOrderPriority
Priority of the raycaster based upon render order.
sortOrderPriority
Priority of the raycaster based upon sort order.
Public Methods
Raycast
Raycast against the Scene.
Protected Methods
OnDisable
See MonoBehaviour.OnDisable.
Inherited Members
Properties
enabled
Enabled Behaviours are Updated, disabled Behaviours are not.
isActiveAndEnabled
Has the Behaviour had active and enabled called?
gameObject
The game object this component is attached to. A component is always attached to a
game object.
tag
The tag of this game object.
transform
The Transform attached to this GameObject.
runInEditMode
Allow a speci c instance of a MonoBehaviour to run in edit mode (only available in the
editor).
useGUILayout
Disabling this lets you skip the GUI layout phase.
hideFlags
Should the object be hidden, saved with the Scene or modi able by the user?
name
The name of the object.
Public Methods
BroadcastMessage
Calls the method named methodName on every MonoBehaviour in this game
object or any of its children.
CompareTag
Is this game object tagged with tag ?
GetComponent
Returns the component of Type type if the game object has one attached, null if
it doesn't.
GetComponentInChildren
Returns the component of Type type in the GameObject or any of its children
using depth rst search.
GetComponentInParent
Returns the component of Type type in the GameObject or any of its parents.
GetComponents
Returns all components of Type type in the GameObject.
GetComponentsInChildren
Returns all components of Type type in the GameObject or any of its children.
GetComponentsInParent
Returns all components of Type type in the GameObject or any of its parents.
SendMessage
Calls the method named methodName on every MonoBehaviour in this game
object.
SendMessageUpwards
Calls the method named methodName on every MonoBehaviour in this game
object and on every ancestor of the behaviour.
CancelInvoke
Cancels all Invoke calls on this MonoBehaviour.
Invoke
Invokes the method methodName in time seconds.
InvokeRepeating
Invokes the method methodName in time seconds, then repeatedly every
repeatRate seconds.
IsInvoking
Is any invoke on methodName pending?
StartCoroutine
Starts a coroutine.
StopAllCoroutines
Stops all coroutines running on this behaviour.
StopCoroutine
Stops the rst coroutine named methodName, or the coroutine stored in routine
running on this behaviour.
GetInstanceID
Returns the instance id of the object.
ToString
Returns the name of the GameObject.
IsActive
Returns true if the GameObject and the Component are active.
IsDestroyed
Returns true if the native representation of the behaviour has been destroyed.
Protected Methods
Awake
See MonoBehaviour.Awake.
OnBeforeTransformParentChanged
See MonoBehaviour.OnBeforeTransformParentChanged.
OnCanvasGroupChanged
See MonoBehaviour.OnCanvasGroupChanged.
OnCanvasHierarchyChanged
Called when the state of the parent Canvas is changed.
OnDestroy
See MonoBehaviour.OnDestroy.
OnDidApplyAnimationProperties
See LayoutGroup.OnDidApplyAnimationProperties.
OnEnable
See MonoBehaviour.OnEnable.
OnRectTransformDimensionsChange
This callback is called if an associated RectTransform has its
dimensions changed.
OnTransformParentChanged
See MonoBehaviour.OnRectTransformParentChanged.
OnValidate
See MonoBehaviour.OnValidate.
Reset
See MonoBehaviour.Reset.
Start
See MonoBehaviour.Start.
Static Methods
print
Logs message to the Unity Console (identical to Debug.Log).
Destroy
Removes a gameobject, component or asset.
DestroyImmediate
Destroys the object obj immediately. You are strongly recommended to use Destroy
instead.
DontDestroyOnLoad
Makes the object target not be destroyed automatically when loading a new Scene.
FindObjectOfType
Returns the rst active loaded object of Type type.
FindObjectsOfType
Returns a list of all active loaded objects of Type type.
Instantiate
Clones the object original and returns the clone.
Operators
bool
Does the object exist?
operator !=
Compares if two objects refer to a di erent object.
operator ==
Compares two object references to see if they refer to the same object.
Messages
Awake
Awake is called when the script instance is being loaded.
FixedUpdate
This function is called every xed framerate frame, if the
MonoBehaviour is enabled.
LateUpdate
LateUpdate is called every frame, if the Behaviour is enabled.
OnAnimatorIK
Callback for setting up animation IK (inverse kinematics).
OnAnimatorMove
Callback for processing animation movements for modifying root
motion.
OnApplicationFocus
Sent to all GameObjects when the player gets or loses focus.
OnApplicationPause
Sent to all GameObjects when the application pauses.
OnApplicationQuit
Sent to all game objects before the application quits.
OnAudioFilterRead
If OnAudioFilterRead is implemented, Unity will insert a custom lter
into the audio DSP chain.
OnBecameInvisible
OnBecameInvisible is called when the renderer is no longer visible by
any camera.
OnBecameVisible
OnBecameVisible is called when the renderer became visible by any
camera.
OnCollisionEnter
OnCollisionEnter is called when this collider/rigidbody has begun
touching another rigidbody/collider.
OnCollisionEnter2D
Sent when an incoming collider makes contact with this object's collider
(2D physics only).
OnCollisionExit
OnCollisionExit is called when this collider/rigidbody has stopped
touching another rigidbody/collider.
OnCollisionExit2D
Sent when a collider on another object stops touching this object's
collider (2D physics only).
OnCollisionStay
:ref::OnCollisionStay is called once per frame for every
collider/rigidbody that is touching rigidbody/collider.
OnCollisionStay2D
Sent each frame where a collider on another object is touching this
object's collider (2D physics only).
OnConnectedToServer
Called on the client when you have successfully connected to a server.
OnControllerColliderHit
OnControllerColliderHit is called when the controller hits a collider while
performing a Move.
OnDestroy
Destroying the attached Behaviour will result in the game or Scene
receiving OnDestroy.
OnDisconnectedFromServer
Called on the client when the connection was lost or you disconnected
from the server.
OnDrawGizmos
Implement OnDrawGizmos if you want to draw gizmos that are also
pickable and always drawn.
OnDrawGizmosSelected
Implement OnDrawGizmosSelected to draw a gizmo if the object is
selected.
OnEnable
This function is called when the object becomes enabled and active.
OnFailedToConnect
Called on the client when a connection attempt fails for some reason.
OnFailedToConnectToMasterServer
Called on clients or servers when there is a problem connecting to the
MasterServer.
OnGUI
OnGUI is called for rendering and handling GUI events.
OnJointBreak
Called when a joint attached to the same game object broke.
OnJointBreak2D
Called when a Joint2D attached to the same game object breaks.
OnMasterServerEvent
Called on clients or servers when reporting events from the
MasterServer.
OnMouseDown
OnMouseDown is called when the user has pressed the mouse button
while over the GUIElement or Collider.
OnMouseDrag
OnMouseDrag is called when the user has clicked on a GUIElement or
Collider and is still holding down the mouse.
OnMouseEnter
Called when the mouse enters the GUIElement or Collider.
OnMouseExit
Called when the mouse is not any longer over the GUIElement or
Collider.
OnMouseOver
Called every frame while the mouse is over the GUIElement or Collider.
OnMouseUp
OnMouseUp is called when the user has released the mouse button.
OnMouseUpAsButton
OnMouseUpAsButton is only called when the mouse is released over
the same GUIElement or Collider as it was pressed.
OnNetworkInstantiate
Called on objects which have been network instantiated with
Network.Instantiate.
OnParticleCollision
OnParticleCollision is called when a particle hits a Collider.
OnParticleSystemStopped
OnParticleSystemStopped is called when all particles in the system have
died, and no new particles will be born. New particles cease to be
created either after Stop is called, or when the duration property of a
non-looping system has been exceeded.
OnParticleTrigger
OnParticleTrigger is called when any particles in a particle system meet
the conditions in the trigger module.
OnPlayerConnected
Called on the server whenever a new player has successfully connected.
OnPlayerDisconnected
Called on the server whenever a player disconnected from the server.
OnPostRender
OnPostRender is called after a camera nished rendering the Scene.
OnPreCull
OnPreCull is called before a camera culls the Scene.
OnPreRender
OnPreRender is called before a camera starts rendering the Scene.
OnRenderImage
OnRenderImage is called after all rendering is complete to render
image.
OnRenderObject
OnRenderObject is called after camera has rendered the Scene.
OnSerializeNetworkView
Used to customize synchronization of variables in a script watched by a
network view.
OnServerInitialized
Called on the server whenever a Network.InitializeServer was invoked
and has completed.
OnTransformChildrenChanged
This function is called when the list of children of the transform of the
GameObject has changed.
OnTransformParentChanged
This function is called when the parent property of the transform of the
GameObject has changed.
OnTriggerEnter
OnTriggerEnter is called when the Collider other enters the trigger.
OnTriggerEnter2D
Sent when another object enters a trigger collider attached to this
object (2D physics only).
OnTriggerExit
OnTriggerExit is called when the Collider other has stopped touching
the trigger.
OnTriggerExit2D
Sent when another object leaves a trigger collider attached to this
object (2D physics only).
OnTriggerStay
OnTriggerStay is called once per physics update for every Collider other
that is touching the trigger.
OnTriggerStay2D
Sent each frame where another object is within a trigger collider
attached to this object (2D physics only).
OnValidate
This function is called when the script is loaded or a value is changed in
the inspector (Called in the editor only).
OnWillRenderObject
OnWillRenderObject is called for each camera if the object is visible and
not a UI element.
Reset
Reset to default values.
Start
Start is called on the frame when a script is enabled just before any of
the Update methods are called the rst time.
Update
Update is called every frame, if the MonoBehaviour is enabled.
Leave feedback
Description
Handles input, raycasting, and sending events.
The EventSystem is responsible for processing and handling events in a Unity Scene. A Scene should only contain
one EventSystem. The EventSystem works in conjunction with a number of modules and mostly just holds state
and delegates functionality to speci c, overrideable components.
When the EventSystem is started it searches for any BaseInputModules attached to the same GameObject and
adds them to an internal list. On update each attached module receives an UpdateModules call, where the
module can modify internal state. After each module has been Updated the active module has the Process call
executed. This is where custom module processing can take place.
Static Properties
current
Return the current EventSystem.
Properties
alreadySelecting
Returns true if the EventSystem is already in a SetSelectedGameObject.
currentInputModule
The currently active BaseInputModule.
currentSelectedGameObject
The GameObject currently considered active by the EventSystem.
rstSelectedGameObject
The GameObject that was selected rst.
isFocused
Flag to say whether the EventSystem thinks it should be paused or not based
upon focused state.
pixelDragThreshold
The soft area for dragging in pixels.
sendNavigationEvents
Should the EventSystem allow navigation events (move / submit / cancel).
Public Methods
IsPointerOverGameObject
Is the pointer with the given ID over an EventSystem object?
RaycastAll
Raycast into the Scene using all con gured BaseRaycasters.
SetSelectedGameObject
Set the GameObject as selected. Will send an OnDeselect the the old selected
object and OnSelect to the new selected object.
UpdateModules
Recalculate the internal list of BaseInputModules.
Protected Methods
OnDisable
See MonoBehaviour.OnDisable.
Inherited Members
Properties
enabled
Enabled Behaviours are Updated, disabled Behaviours are not.
isActiveAndEnabled
Has the Behaviour had active and enabled called?
gameObject
The game object this component is attached to. A component is always attached to a
game object.
tag
The tag of this game object.
transform
The Transform attached to this GameObject.
runInEditMode
Allow a speci c instance of a MonoBehaviour to run in edit mode (only available in the
editor).
useGUILayout
Disabling this lets you skip the GUI layout phase.
hideFlags
Should the object be hidden, saved with the Scene or modi able by the user?
name
The name of the object.
Public Methods
BroadcastMessage
Calls the method named methodName on every MonoBehaviour in this game
object or any of its children.
CompareTag
Is this game object tagged with tag ?
GetComponent
Returns the component of Type type if the game object has one attached, null if
it doesn't.
GetComponentInChildren
Returns the component of Type type in the GameObject or any of its children
using depth rst search.
GetComponentInParent
Returns the component of Type type in the GameObject or any of its parents.
GetComponents
Returns all components of Type type in the GameObject.
GetComponentsInChildren
Returns all components of Type type in the GameObject or any of its children.
GetComponentsInParent
Returns all components of Type type in the GameObject or any of its parents.
SendMessage
Calls the method named methodName on every MonoBehaviour in this game
object.
SendMessageUpwards
Calls the method named methodName on every MonoBehaviour in this game
object and on every ancestor of the behaviour.
CancelInvoke
Cancels all Invoke calls on this MonoBehaviour.
Invoke
Invokes the method methodName in time seconds.
InvokeRepeating
Invokes the method methodName in time seconds, then repeatedly every
repeatRate seconds.
IsInvoking
Is any invoke on methodName pending?
StartCoroutine
Starts a coroutine.
StopAllCoroutines
Stops all coroutines running on this behaviour.
StopCoroutine
Stops the rst coroutine named methodName, or the coroutine stored in routine
running on this behaviour.
GetInstanceID
Returns the instance id of the object.
ToString
Returns the name of the GameObject.
IsActive
Returns true if the GameObject and the Component are active.
IsDestroyed
Returns true if the native representation of the behaviour has been destroyed.
Protected Methods
Awake
See MonoBehaviour.Awake.
OnBeforeTransformParentChanged
See MonoBehaviour.OnBeforeTransformParentChanged.
OnCanvasGroupChanged
See MonoBehaviour.OnCanvasGroupChanged.
OnCanvasHierarchyChanged
Called when the state of the parent Canvas is changed.
OnDestroy
See MonoBehaviour.OnDestroy.
OnDidApplyAnimationProperties
See LayoutGroup.OnDidApplyAnimationProperties.
OnEnable
See MonoBehaviour.OnEnable.
OnRectTransformDimensionsChange
This callback is called if an associated RectTransform has its
dimensions changed.
OnTransformParentChanged
See MonoBehaviour.OnRectTransformParentChanged.
OnValidate
See MonoBehaviour.OnValidate.
Reset
See MonoBehaviour.Reset.
Start
See MonoBehaviour.Start.
Static Methods
print
Logs message to the Unity Console (identical to Debug.Log).
Destroy
Removes a gameobject, component or asset.
DestroyImmediate
Destroys the object obj immediately. You are strongly recommended to use Destroy
instead.
DontDestroyOnLoad
Makes the object target not be destroyed automatically when loading a new Scene.
FindObjectOfType
Returns the rst active loaded object of Type type.
FindObjectsOfType
Returns a list of all active loaded objects of Type type.
Instantiate
Clones the object original and returns the clone.
Operators
bool
Does the object exist?
operator !=
Compares if two objects refer to a di erent object.
operator ==
Compares two object references to see if they refer to the same object.
Messages
Awake
Awake is called when the script instance is being loaded.
FixedUpdate
This function is called every xed framerate frame, if the
MonoBehaviour is enabled.
LateUpdate
LateUpdate is called every frame, if the Behaviour is enabled.
OnAnimatorIK
Callback for setting up animation IK (inverse kinematics).
OnAnimatorMove
Callback for processing animation movements for modifying root
motion.
OnApplicationFocus
Sent to all GameObjects when the player gets or loses focus.
OnApplicationPause
Sent to all GameObjects when the application pauses.
OnApplicationQuit
Sent to all game objects before the application quits.
OnAudioFilterRead
If OnAudioFilterRead is implemented, Unity will insert a custom lter
into the audio DSP chain.
OnBecameInvisible
OnBecameInvisible is called when the renderer is no longer visible by
any camera.
OnBecameVisible
OnBecameVisible is called when the renderer became visible by any
camera.
OnCollisionEnter
OnCollisionEnter is called when this collider/rigidbody has begun
touching another rigidbody/collider.
OnCollisionEnter2D
Sent when an incoming collider makes contact with this object's collider
(2D physics only).
OnCollisionExit
OnCollisionExit is called when this collider/rigidbody has stopped
touching another rigidbody/collider.
OnCollisionExit2D
Sent when a collider on another object stops touching this object's
collider (2D physics only).
OnCollisionStay
:ref::OnCollisionStay is called once per frame for every
collider/rigidbody that is touching rigidbody/collider.
OnCollisionStay2D
Sent each frame where a collider on another object is touching this
object's collider (2D physics only).
OnConnectedToServer
Called on the client when you have successfully connected to a server.
OnControllerColliderHit
OnControllerColliderHit is called when the controller hits a collider while
performing a Move.
OnDestroy
Destroying the attached Behaviour will result in the game or Scene
receiving OnDestroy.
OnDisconnectedFromServer
Called on the client when the connection was lost or you disconnected
from the server.
OnDrawGizmos
Implement OnDrawGizmos if you want to draw gizmos that are also
pickable and always drawn.
OnDrawGizmosSelected
Implement OnDrawGizmosSelected to draw a gizmo if the object is
selected.
OnEnable
This function is called when the object becomes enabled and active.
OnFailedToConnect
Called on the client when a connection attempt fails for some reason.
OnFailedToConnectToMasterServer
Called on clients or servers when there is a problem connecting to the
MasterServer.
OnGUI
OnGUI is called for rendering and handling GUI events.
OnJointBreak
Called when a joint attached to the same game object broke.
OnJointBreak2D
Called when a Joint2D attached to the same game object breaks.
OnMasterServerEvent
Called on clients or servers when reporting events from the
MasterServer.
OnMouseDown
OnMouseDown is called when the user has pressed the mouse button
while over the GUIElement or Collider.
OnMouseDrag
OnMouseDrag is called when the user has clicked on a GUIElement or
Collider and is still holding down the mouse.
OnMouseEnter
Called when the mouse enters the GUIElement or Collider.
OnMouseExit
Called when the mouse is not any longer over the GUIElement or
Collider.
OnMouseOver
Called every frame while the mouse is over the GUIElement or Collider.
OnMouseUp
OnMouseUp is called when the user has released the mouse button.
OnMouseUpAsButton
OnMouseUpAsButton is only called when the mouse is released over
the same GUIElement or Collider as it was pressed.
OnNetworkInstantiate
Called on objects which have been network instantiated with
Network.Instantiate.
OnParticleCollision
OnParticleCollision is called when a particle hits a Collider.
OnParticleSystemStopped
OnParticleSystemStopped is called when all particles in the system have
died, and no new particles will be born. New particles cease to be
created either after Stop is called, or when the duration property of a
non-looping system has been exceeded.
OnParticleTrigger
OnParticleTrigger is called when any particles in a particle system meet
the conditions in the trigger module.
OnPlayerConnected
Called on the server whenever a new player has successfully connected.
OnPlayerDisconnected
Called on the server whenever a player disconnected from the server.
OnPostRender
OnPostRender is called after a camera nished rendering the Scene.
OnPreCull
OnPreCull is called before a camera culls the Scene.
OnPreRender
OnPreRender is called before a camera starts rendering the Scene.
OnRenderImage
OnRenderImage is called after all rendering is complete to render
image.
OnRenderObject
OnRenderObject is called after camera has rendered the Scene.
OnSerializeNetworkView
Used to customize synchronization of variables in a script watched by a
network view.
OnServerInitialized
Called on the server whenever a Network.InitializeServer was invoked
and has completed.
OnTransformChildrenChanged
This function is called when the list of children of the transform of the
GameObject has changed.
OnTransformParentChanged
This function is called when the parent property of the transform of the
GameObject has changed.
OnTriggerEnter
OnTriggerEnter is called when the Collider other enters the trigger.
OnTriggerEnter2D
Sent when another object enters a trigger collider attached to this
object (2D physics only).
OnTriggerExit
OnTriggerExit is called when the Collider other has stopped touching
the trigger.
OnTriggerExit2D
Sent when another object leaves a trigger collider attached to this
object (2D physics only).
OnTriggerStay
OnTriggerStay is called once per physics update for every Collider other
that is touching the trigger.
OnTriggerStay2D
Sent each frame where another object is within a trigger collider
attached to this object (2D physics only).
OnValidate
This function is called when the script is loaded or a value is changed in
the inspector (Called in the editor only).
OnWillRenderObject
OnWillRenderObject is called for each camera if the object is visible and
not a UI element.
Reset
Reset to default values.
Start
Start is called on the frame when a script is enabled just before any of
the Update methods are called the rst time.
Update
Update is called every frame, if the MonoBehaviour is enabled.
Leave feedback
Implements interfaces:IBeginDragHandler, ICancelHandler, IDeselectHandler, IDragHandler, IDropHandler,
IEndDragHandler, IEventSystemHandler, IInitializePotentialDragHandler, IMoveHandler, IPointerClickHandler,
IPointerDownHandler, IPointerEnterHandler, IPointerExitHandler, IPointerUpHandler, IScrollHandler,
ISelectHandler, ISubmitHandler, IUpdateSelectedHandler
Description
Receives events from the EventSystem and calls registered functions for each event.
The EventTrigger can be used to specify functions you wish to be called for each EventSystem event. You can
assign multiple functions to a single event and whenever the EventTrigger receives that event it will call those
functions in the order they were provided.
NOTE: Attaching this component to a GameObject will make that object intercept ALL events, and no events will
propagate to parent objects.
There are two ways to intercept events: You could extend EventTrigger, and override the functions for the events
you are interested in intercepting; as shown in this example:
using UnityEngine;
using UnityEngine.EventSystems;
public class EventTriggerExample : EventTrigger
{
public override void OnBeginDrag(PointerEventData data)
{
Debug.Log("OnBeginDrag called.");
}
public override void OnCancel(BaseEventData data)
{
Debug.Log("OnCancel called.");
}
public override void OnDeselect(BaseEventData data)
{
Debug.Log("OnDeselect called.");
}
public override void OnDrag(PointerEventData data)
{
Debug.Log("OnDrag called.");
}
public override void OnDrop(PointerEventData data)
{
Debug.Log("OnDrop called.");
}
public override void OnEndDrag(PointerEventData data)
{
Debug.Log("OnEndDrag called.");
}
public override void OnInitializePotentialDrag(PointerEventData data)
{
Debug.Log("OnInitializePotentialDrag called.");
}
public override void OnMove(AxisEventData data)
{
Debug.Log("OnMove called.");
}
public override void OnPointerClick(PointerEventData data)
{
Debug.Log("OnPointerClick called.");
}
public override void OnPointerDown(PointerEventData data)
{
Debug.Log("OnPointerDown called.");
}
public override void OnPointerEnter(PointerEventData data)
{
Debug.Log("OnPointerEnter called.");
}
public override void OnPointerExit(PointerEventData data)
{
Debug.Log("OnPointerExit called.");
}
public override void OnPointerUp(PointerEventData data)
{
Debug.Log("OnPointerUp called.");
}
public override void OnScroll(PointerEventData data)
{
Debug.Log("OnScroll called.");
}
public override void OnSelect(BaseEventData data)
{
Debug.Log("OnSelect called.");
}
public override void OnSubmit(BaseEventData data)
{
Debug.Log("OnSubmit called.");
}
public override void OnUpdateSelected(BaseEventData data)
{
Debug.Log("OnUpdateSelected called.");
}
}
...or you can specify individual delegates:
using UnityEngine;
using UnityEngine.EventSystems;
public class EventTriggerDelegateExample : MonoBehaviour
{
void Start()
{
EventTrigger trigger = GetComponent();
EventTrigger.Entry entry = new EventTrigger.Entry();
entry.eventID = EventTriggerType.PointerDown;
entry.callback.AddListener((data) => { OnPointerDownDelegate((PointerEve
trigger.triggers.Add(entry);
}
public void OnPointerDownDelegate(PointerEventData data)
{
Debug.Log("OnPointerDownDelegate called.");
}
}
Properties
triggers
All the functions registered in this EventTrigger.
Public Methods
OnBeginDrag
Called before a drag is started.
OnCancel
Called by the EventSystem when a Cancel event occurs.
OnDeselect
Called by the EventSystem when a new object is being selected.
OnDrag
Called by the EventSystem every time the pointer is moved during dragging.
OnDrop
Called by the EventSystem when an object accepts a drop.
OnEndDrag
Called by the EventSystem once dragging ends.
OnInitializePotentialDrag
Called by the EventSystem when a drag has been found, but before it is valid to
begin the drag.
OnMove
Called by the EventSystem when a Move event occurs.
OnPointerClick
Called by the EventSystem when a Click event occurs.
OnPointerDown
Called by the EventSystem when a PointerDown event occurs.
OnPointerEnter
Called by the EventSystem when the pointer enters the object associated with this
EventTrigger.
OnPointerExit
Called by the EventSystem when the pointer exits the object associated with this
EventTrigger.
OnPointerUp
Called by the EventSystem when a PointerUp event occurs.
OnScroll
Called by the EventSystem when a Scroll event occurs.
OnSelect
Called by the EventSystem when a Select event occurs.
OnSubmit
Called by the EventSystem when a Submit event occurs.
OnUpdateSelected
Called by the EventSystem when the object associated with this EventTrigger is
updated.
Inherited Members
Properties
enabled
Enabled Behaviours are Updated, disabled Behaviours are not.
isActiveAndEnabled
Has the Behaviour had active and enabled called?
gameObject
The game object this component is attached to. A component is always attached to a
game object.
tag
The tag of this game object.
transform
The Transform attached to this GameObject.
runInEditMode
Allow a speci c instance of a MonoBehaviour to run in edit mode (only available in the
editor).
useGUILayout
Disabling this lets you skip the GUI layout phase.
hideFlags
Should the object be hidden, saved with the Scene or modi able by the user?
name
The name of the object.
Public Methods
BroadcastMessage
Calls the method named methodName on every MonoBehaviour in this game
object or any of its children.
CompareTag
Is this game object tagged with tag ?
GetComponent
Returns the component of Type type if the game object has one attached, null if
it doesn't.
GetComponentInChildren
Returns the component of Type type in the GameObject or any of its children
using depth rst search.
GetComponentInParent
Returns the component of Type type in the GameObject or any of its parents.
GetComponents
Returns all components of Type type in the GameObject.
GetComponentsInChildren
Returns all components of Type type in the GameObject or any of its children.
GetComponentsInParent
Returns all components of Type type in the GameObject or any of its parents.
SendMessage
Calls the method named methodName on every MonoBehaviour in this game
object.
SendMessageUpwards
Calls the method named methodName on every MonoBehaviour in this game
object and on every ancestor of the behaviour.
CancelInvoke
Cancels all Invoke calls on this MonoBehaviour.
Invoke
Invokes the method methodName in time seconds.
InvokeRepeating
Invokes the method methodName in time seconds, then repeatedly every
repeatRate seconds.
IsInvoking
Is any invoke on methodName pending?
StartCoroutine
Starts a coroutine.
StopAllCoroutines
Stops all coroutines running on this behaviour.
StopCoroutine
Stops the rst coroutine named methodName, or the coroutine stored in routine
running on this behaviour.
GetInstanceID
Returns the instance id of the object.
ToString
Returns the name of the GameObject.
Static Methods
print
Logs message to the Unity Console (identical to Debug.Log).
Destroy
Removes a gameobject, component or asset.
DestroyImmediate
Destroys the object obj immediately. You are strongly recommended to use Destroy
instead.
DontDestroyOnLoad
Makes the object target not be destroyed automatically when loading a new Scene.
FindObjectOfType
Returns the rst active loaded object of Type type.
FindObjectsOfType
Returns a list of all active loaded objects of Type type.
Instantiate
Clones the object original and returns the clone.
Operators
p
bool
Does the object exist?
operator !=
Compares if two objects refer to a di erent object.
operator ==
Compares two object references to see if they refer to the same object.
Messages
Awake
Awake is called when the script instance is being loaded.
FixedUpdate
This function is called every xed framerate frame, if the
MonoBehaviour is enabled.
LateUpdate
LateUpdate is called every frame, if the Behaviour is enabled.
OnAnimatorIK
Callback for setting up animation IK (inverse kinematics).
OnAnimatorMove
Callback for processing animation movements for modifying root
motion.
OnApplicationFocus
Sent to all GameObjects when the player gets or loses focus.
OnApplicationPause
Sent to all GameObjects when the application pauses.
OnApplicationQuit
Sent to all game objects before the application quits.
OnAudioFilterRead
If OnAudioFilterRead is implemented, Unity will insert a custom lter
into the audio DSP chain.
OnBecameInvisible
OnBecameInvisible is called when the renderer is no longer visible by
any camera.
OnBecameVisible
OnBecameVisible is called when the renderer became visible by any
camera.
OnCollisionEnter
OnCollisionEnter is called when this collider/rigidbody has begun
touching another rigidbody/collider.
OnCollisionEnter2D
Sent when an incoming collider makes contact with this object's collider
(2D physics only).
OnCollisionExit
OnCollisionExit is called when this collider/rigidbody has stopped
touching another rigidbody/collider.
OnCollisionExit2D
Sent when a collider on another object stops touching this object's
collider (2D physics only).
OnCollisionStay
:ref::OnCollisionStay is called once per frame for every
collider/rigidbody that is touching rigidbody/collider.
OnCollisionStay2D
Sent each frame where a collider on another object is touching this
object's collider (2D physics only).
OnConnectedToServer
Called on the client when you have successfully connected to a server.
OnControllerColliderHit
OnControllerColliderHit is called when the controller hits a collider while
performing a Move.
OnDestroy
Destroying the attached Behaviour will result in the game or Scene
receiving OnDestroy.
OnDisable
This function is called when the behaviour becomes disabled.
OnDisconnectedFromServer
Called on the client when the connection was lost or you disconnected
from the server.
OnDrawGizmos
Implement OnDrawGizmos if you want to draw gizmos that are also
pickable and always drawn.
OnDrawGizmosSelected
Implement OnDrawGizmosSelected to draw a gizmo if the object is
selected.
OnEnable
This function is called when the object becomes enabled and active.
OnFailedToConnect
Called on the client when a connection attempt fails for some reason.
OnFailedToConnectToMasterServer
Called on clients or servers when there is a problem connecting to the
MasterServer.
OnGUI
OnGUI is called for rendering and handling GUI events.
OnJointBreak
Called when a joint attached to the same game object broke.
OnJointBreak2D
Called when a Joint2D attached to the same game object breaks.
OnMasterServerEvent
Called on clients or servers when reporting events from the
MasterServer.
OnMouseDown
OnMouseDown is called when the user has pressed the mouse button
while over the GUIElement or Collider.
OnMouseDrag
OnMouseDrag is called when the user has clicked on a GUIElement or
Collider and is still holding down the mouse.
OnMouseEnter
Called when the mouse enters the GUIElement or Collider.
OnMouseExit
Called when the mouse is not any longer over the GUIElement or
Collider.
OnMouseOver
Called every frame while the mouse is over the GUIElement or Collider.
OnMouseUp
OnMouseUp is called when the user has released the mouse button.
OnMouseUpAsButton
OnMouseUpAsButton is only called when the mouse is released over
the same GUIElement or Collider as it was pressed.
OnNetworkInstantiate
Called on objects which have been network instantiated with
Network.Instantiate.
OnParticleCollision
OnParticleCollision is called when a particle hits a Collider.
OnParticleSystemStopped
OnParticleSystemStopped is called when all particles in the system have
died, and no new particles will be born. New particles cease to be
created either after Stop is called, or when the duration property of a
non-looping system has been exceeded.
OnParticleTrigger
OnParticleTrigger is called when any particles in a particle system meet
the conditions in the trigger module.
OnPlayerConnected
Called on the server whenever a new player has successfully connected.
OnPlayerDisconnected
Called on the server whenever a player disconnected from the server.
OnPostRender
OnPostRender is called after a camera nished rendering the Scene.
OnPreCull
OnPreCull is called before a camera culls the Scene.
OnPreRender
OnPreRender is called before a camera starts rendering the Scene.
OnRenderImage
OnRenderImage is called after all rendering is complete to render
image.
OnRenderObject
OnRenderObject is called after camera has rendered the Scene.
OnSerializeNetworkView
Used to customize synchronization of variables in a script watched by a
network view.
OnServerInitialized
Called on the server whenever a Network.InitializeServer was invoked
and has completed.
OnTransformChildrenChanged
This function is called when the list of children of the transform of the
GameObject has changed.
OnTransformParentChanged
This function is called when the parent property of the transform of the
GameObject has changed.
OnTriggerEnter
OnTriggerEnter is called when the Collider other enters the trigger.
OnTriggerEnter2D
Sent when another object enters a trigger collider attached to this
object (2D physics only).
OnTriggerExit
OnTriggerExit is called when the Collider other has stopped touching
the trigger.
OnTriggerExit2D
Sent when another object leaves a trigger collider attached to this
object (2D physics only).
OnTriggerStay
OnTriggerStay is called once per physics update for every Collider other
that is touching the trigger.
OnTriggerStay2D
Sent each frame where another object is within a trigger collider
attached to this object (2D physics only).
OnValidate
This function is called when the script is loaded or a value is changed in
the inspector (Called in the editor only).
OnWillRenderObject
OnWillRenderObject is called for each camera if the object is visible and
not a UI element.
Reset
Reset to default values.
Start
Start is called on the frame when a script is enabled just before any of
the Update methods are called the rst time.
Update
Update is called every frame, if the MonoBehaviour is enabled.
Leave feedback
Description
An Entry in the EventSystem delegates list.
It stores the callback and which event type should this callback be red.
Properties
callback
The desired TriggerEvent to be Invoked.
eventID
What type of event is the associated callback listening for.
Leave feedback
Description
UnityEvent class for Triggers.
See EventTrigger for example usage.
Inherited Members
Public Methods
GetPersistentEventCount
Get the number of registered persistent listeners.
GetPersistentMethodName
Get the target method name of the listener at index index.
GetPersistentTarget
Get the target component of the listener at index index.
RemoveAllListeners
Remove all non-persisent (ie created from script) listeners from the event.
SetPersistentListenerState
Modify the execution state of a persistent listener.
Static Methods
GetValidMethodInfo
Given an object, function name, and a list of argument types; nd the method that
matches.
Leave feedback
Description
Helper class that can be used to send IEventSystemHandler events to GameObjects.
Static Properties
beginDragHandler
IBeginDragHandler execute helper function.
cancelHandler
ICancelHandler execute helper function.
deselectHandler
IDeselectHandler execute helper function.
dragHandler
IDragHandler execute helper function.
dropHandler
IDropHandler execute helper function.
endDragHandler
IEndDragHandler execute helper function.
initializePotentialDrag
IInitializePotentialDragHandler execute helper function.
moveHandler
IMoveHandler execute helper function.
pointerClickHandler
IPointerClickHandler execute helper function.
pointerDownHandler
IPointerDownHandler execute helper function.
pointerEnterHandler
IPointerEnterHandler execute helper function.
pointerExitHandler
IPointerExitHandler execute helper function.
pointerUpHandler
IPointerUpHandler execute helper function.
scrollHandler
IScrollHandler execute helper function.
selectHandler
ISelectHandler execute helper function.
submitHandler
ISubmitHandler execute helper function.
updateSelectedHandler
IUpdateSelectedHandler execute helper function.
Static Methods
CanHandleEvent
Can the given GameObject handle the IEventSystemHandler of type T.
Execute
Execute the event of type T : IEventSystemHandler on GameObject.
ExecuteHierarchy
Recurse up the hierarchy calling Execute until there is a GameObject that can handle
the event.
GetEventHandler
Traverse the object hierarchy starting at root, and return the GameObject which
implements the event handler of type .
ValidateEventData
Attempt to convert the data to type T. If conversion fails an ArgumentException is
thrown.
Delegates
EventFunction
Function de nition for an EventFunction that is used to map a given EventInterface into
a speci c event call.
Leave feedback
Description
Raycaster for casting against 2D Physics components.
See: BaseRaycaster.
Public Methods
Raycast
See: BaseRaycaster.
Inherited Members
Properties
eventCamera
The camera that will generate rays for this raycaster.
renderOrderPriority
Priority of the raycaster based upon render order.
sortOrderPriority
Priority of the raycaster based upon sort order.
enabled
Enabled Behaviours are Updated, disabled Behaviours are not.
isActiveAndEnabled
Has the Behaviour had active and enabled called?
gameObject
The game object this component is attached to. A component is always attached to a
game object.
tag
The tag of this game object.
transform
The Transform attached to this GameObject.
runInEditMode
Allow a speci c instance of a MonoBehaviour to run in edit mode (only available in the
editor).
useGUILayout
Disabling this lets you skip the GUI layout phase.
hideFlags
Should the object be hidden, saved with the Scene or modi able by the user?
name
The name of the object.
depth
Get the depth of the con gured camera.
eventCamera
Get the camera that is used for this module.
eventMask
Mask of allowed raycast events.
nalEventMask
maxRayIntersections
Logical and of Camera mask and eventMask.
Max number of ray intersection allowed to be found.
Public Methods
BroadcastMessage
Calls the method named methodName on every MonoBehaviour in this game
object or any of its children.
CompareTag
Is this game object tagged with tag ?
GetComponent
Returns the component of Type type if the game object has one attached, null if
it doesn't.
GetComponentInChildren
Returns the component of Type type in the GameObject or any of its children
using depth rst search.
GetComponentInParent
Returns the component of Type type in the GameObject or any of its parents.
GetComponents
Returns all components of Type type in the GameObject.
GetComponentsInChildren
Returns all components of Type type in the GameObject or any of its children.
GetComponentsInParent
Returns all components of Type type in the GameObject or any of its parents.
SendMessage
Calls the method named methodName on every MonoBehaviour in this game
object.
SendMessageUpwards
Calls the method named methodName on every MonoBehaviour in this game
object and on every ancestor of the behaviour.
CancelInvoke
Cancels all Invoke calls on this MonoBehaviour.
Invoke
Invokes the method methodName in time seconds.
InvokeRepeating
Invokes the method methodName in time seconds, then repeatedly every
repeatRate seconds.
IsInvoking
Is any invoke on methodName pending?
StartCoroutine
Starts a coroutine.
StopAllCoroutines
Stops all coroutines running on this behaviour.
StopCoroutine
Stops the rst coroutine named methodName, or the coroutine stored in routine
running on this behaviour.
GetInstanceID
Returns the instance id of the object.
ToString
Returns the name of the GameObject.
IsActive
Returns true if the GameObject and the Component are active.
IsDestroyed
Returns true if the native representation of the behaviour has been destroyed.
Protected Methods
OnDisable
See MonoBehaviour.OnDisable.
ComputeRayAndDistance
Returns a ray going from camera through the event position and the
distance between the near and far clipping planes along that ray.
Awake
See MonoBehaviour.Awake.
OnBeforeTransformParentChanged
See MonoBehaviour.OnBeforeTransformParentChanged.
OnCanvasGroupChanged
See MonoBehaviour.OnCanvasGroupChanged.
OnCanvasHierarchyChanged
Called when the state of the parent Canvas is changed.
OnDestroy
See MonoBehaviour.OnDestroy.
OnDidApplyAnimationProperties
See LayoutGroup.OnDidApplyAnimationProperties.
OnDisable
See MonoBehaviour.OnDisable.
OnEnable
See MonoBehaviour.OnEnable.
OnRectTransformDimensionsChange
This callback is called if an associated RectTransform has its
dimensions changed.
OnTransformParentChanged
See MonoBehaviour.OnRectTransformParentChanged.
OnValidate
See MonoBehaviour.OnValidate.
Reset
See MonoBehaviour.Reset.
Start
See MonoBehaviour.Start.
Static Methods
print
Logs message to the Unity Console (identical to Debug.Log).
Destroy
Removes a gameobject, component or asset.
DestroyImmediate
Destroys the object obj immediately. You are strongly recommended to use Destroy
instead.
DontDestroyOnLoad
Makes the object target not be destroyed automatically when loading a new Scene.
FindObjectOfType
Returns the rst active loaded object of Type type.
FindObjectsOfType
Returns a list of all active loaded objects of Type type.
Instantiate
Clones the object original and returns the clone.
Operators
bool
Does the object exist?
operator !=
Compares if two objects refer to a di erent object.
operator ==
Compares two object references to see if they refer to the same object.
Messages
Awake
Awake is called when the script instance is being loaded.
FixedUpdate
This function is called every xed framerate frame, if the
MonoBehaviour is enabled.
LateUpdate
LateUpdate is called every frame, if the Behaviour is enabled.
OnAnimatorIK
Callback for setting up animation IK (inverse kinematics).
OnAnimatorMove
Callback for processing animation movements for modifying root
motion.
OnApplicationFocus
Sent to all GameObjects when the player gets or loses focus.
OnApplicationPause
Sent to all GameObjects when the application pauses.
OnApplicationQuit
Sent to all game objects before the application quits.
OnAudioFilterRead
If OnAudioFilterRead is implemented, Unity will insert a custom lter
into the audio DSP chain.
OnBecameInvisible
OnBecameInvisible is called when the renderer is no longer visible by
any camera.
OnBecameVisible
OnBecameVisible is called when the renderer became visible by any
camera.
OnCollisionEnter
OnCollisionEnter is called when this collider/rigidbody has begun
touching another rigidbody/collider.
OnCollisionEnter2D
Sent when an incoming collider makes contact with this object's collider
(2D physics only).
OnCollisionExit
OnCollisionExit is called when this collider/rigidbody has stopped
touching another rigidbody/collider.
OnCollisionExit2D
Sent when a collider on another object stops touching this object's
collider (2D physics only).
OnCollisionStay
:ref::OnCollisionStay is called once per frame for every
collider/rigidbody that is touching rigidbody/collider.
OnCollisionStay2D
Sent each frame where a collider on another object is touching this
object's collider (2D physics only).
OnConnectedToServer
Called on the client when you have successfully connected to a server.
OnControllerColliderHit
OnControllerColliderHit is called when the controller hits a collider while
performing a Move.
OnDestroy
Destroying the attached Behaviour will result in the game or Scene
receiving OnDestroy.
OnDisable
This function is called when the behaviour becomes disabled.
OnDisconnectedFromServer
Called on the client when the connection was lost or you disconnected
from the server.
OnDrawGizmos
Implement OnDrawGizmos if you want to draw gizmos that are also
pickable and always drawn.
OnDrawGizmosSelected
Implement OnDrawGizmosSelected to draw a gizmo if the object is
selected.
OnEnable
This function is called when the object becomes enabled and active.
OnFailedToConnect
Called on the client when a connection attempt fails for some reason.
OnFailedToConnectToMasterServer
Called on clients or servers when there is a problem connecting to the
MasterServer.
OnGUI
OnGUI is called for rendering and handling GUI events.
OnJointBreak
Called when a joint attached to the same game object broke.
OnJointBreak2D
Called when a Joint2D attached to the same game object breaks.
OnMasterServerEvent
Called on clients or servers when reporting events from the
MasterServer.
OnMouseDown
OnMouseDown is called when the user has pressed the mouse button
while over the GUIElement or Collider.
OnMouseDrag
OnMouseDrag is called when the user has clicked on a GUIElement or
Collider and is still holding down the mouse.
OnMouseEnter
Called when the mouse enters the GUIElement or Collider.
OnMouseExit
Called when the mouse is not any longer over the GUIElement or
Collider.
OnMouseOver
Called every frame while the mouse is over the GUIElement or Collider.
OnMouseUp
OnMouseUp is called when the user has released the mouse button.
OnMouseUpAsButton
OnMouseUpAsButton is only called when the mouse is released over
the same GUIElement or Collider as it was pressed.
OnNetworkInstantiate
Called on objects which have been network instantiated with
Network.Instantiate.
OnParticleCollision
OnParticleCollision is called when a particle hits a Collider.
OnParticleSystemStopped
OnParticleSystemStopped is called when all particles in the system have
died, and no new particles will be born. New particles cease to be
created either after Stop is called, or when the duration property of a
non-looping system has been exceeded.
OnParticleTrigger
OnParticleTrigger is called when any particles in a particle system meet
the conditions in the trigger module.
OnPlayerConnected
Called on the server whenever a new player has successfully connected.
OnPlayerDisconnected
Called on the server whenever a player disconnected from the server.
OnPostRender
OnPostRender is called after a camera nished rendering the Scene.
OnPreCull
OnPreCull is called before a camera culls the Scene.
OnPreRender
OnPreRender is called before a camera starts rendering the Scene.
OnRenderImage
OnRenderImage is called after all rendering is complete to render
image.
OnRenderObject
OnRenderObject is called after camera has rendered the Scene.
OnSerializeNetworkView
Used to customize synchronization of variables in a script watched by a
network view.
OnServerInitialized
Called on the server whenever a Network.InitializeServer was invoked
and has completed.
OnTransformChildrenChanged
This function is called when the list of children of the transform of the
GameObject has changed.
OnTransformParentChanged
This function is called when the parent property of the transform of the
GameObject has changed.
OnTriggerEnter
OnTriggerEnter is called when the Collider other enters the trigger.
OnTriggerEnter2D
Sent when another object enters a trigger collider attached to this
object (2D physics only).
OnTriggerExit
OnTriggerExit is called when the Collider other has stopped touching
the trigger.
OnTriggerExit2D
Sent when another object leaves a trigger collider attached to this
object (2D physics only).
OnTriggerStay
OnTriggerStay is called once per physics update for every Collider other
that is touching the trigger.
OnTriggerStay2D
Sent each frame where another object is within a trigger collider
attached to this object (2D physics only).
OnValidate
This function is called when the script is loaded or a value is changed in
the inspector (Called in the editor only).
OnWillRenderObject
OnWillRenderObject is called for each camera if the object is visible and
not a UI element.
Reset
Reset to default values.
Start
Start is called on the frame when a script is enabled just before any of
the Update methods are called the rst time.
Update
Update is called every frame, if the MonoBehaviour is enabled.
Leave feedback
Description
Raycaster for casting against 3D Physics components.
See: BaseRaycaster.
Properties
depth
Get the depth of the con gured camera.
eventCamera
Get the camera that is used for this module.
eventMask
Mask of allowed raycast events.
nalEventMask
Logical and of Camera mask and eventMask.
maxRayIntersections
Max number of ray intersection allowed to be found.
Public Methods
Raycast
See: BaseRaycaster.
Protected Methods
ComputeRayAndDistance
Returns a ray going from camera through the event position and the distance
between the near and far clipping planes along that ray.
Inherited Members
Properties
eventCamera
The camera that will generate rays for this raycaster.
renderOrderPriority
Priority of the raycaster based upon render order.
sortOrderPriority
Priority of the raycaster based upon sort order.
enabled
Enabled Behaviours are Updated, disabled Behaviours are not.
isActiveAndEnabled
Has the Behaviour had active and enabled called?
gameObject
The game object this component is attached to. A component is always attached to a
game object.
tag
The tag of this game object.
transform
The Transform attached to this GameObject.
runInEditMode
Allow a speci c instance of a MonoBehaviour to run in edit mode (only available in the
editor).
useGUILayout
Disabling this lets you skip the GUI layout phase.
hideFlags
Should the object be hidden, saved with the Scene or modi able by the user?
name
The name of the object.
Public Methods
BroadcastMessage
Calls the method named methodName on every MonoBehaviour in this game
object or any of its children.
CompareTag
Is this game object tagged with tag ?
GetComponent
Returns the component of Type type if the game object has one attached, null if
it doesn't.
GetComponentInChildren
Returns the component of Type type in the GameObject or any of its children
using depth rst search.
GetComponentInParent
Returns the component of Type type in the GameObject or any of its parents.
GetComponents
Returns all components of Type type in the GameObject.
GetComponentsInChildren
Returns all components of Type type in the GameObject or any of its children.
GetComponentsInParent
Returns all components of Type type in the GameObject or any of its parents.
SendMessage
Calls the method named methodName on every MonoBehaviour in this game
object.
SendMessageUpwards
Calls the method named methodName on every MonoBehaviour in this game
object and on every ancestor of the behaviour.
CancelInvoke
Cancels all Invoke calls on this MonoBehaviour.
Invoke
Invokes the method methodName in time seconds.
InvokeRepeating
Invokes the method methodName in time seconds, then repeatedly every
repeatRate seconds.
IsInvoking
Is any invoke on methodName pending?
StartCoroutine
Starts a coroutine.
StopAllCoroutines
Stops all coroutines running on this behaviour.
StopCoroutine
Stops the rst coroutine named methodName, or the coroutine stored in routine
running on this behaviour.
GetInstanceID
Returns the instance id of the object.
ToString
Returns the name of the GameObject.
IsActive
Returns true if the GameObject and the Component are active.
IsDestroyed
Returns true if the native representation of the behaviour has been destroyed.
Protected Methods
OnDisable
See MonoBehaviour.OnDisable.
Awake
See MonoBehaviour.Awake.
OnBeforeTransformParentChanged
See MonoBehaviour.OnBeforeTransformParentChanged.
OnCanvasGroupChanged
See MonoBehaviour.OnCanvasGroupChanged.
OnCanvasHierarchyChanged
Called when the state of the parent Canvas is changed.
OnDestroy
See MonoBehaviour.OnDestroy.
OnDidApplyAnimationProperties
See LayoutGroup.OnDidApplyAnimationProperties.
OnDisable
See MonoBehaviour.OnDisable.
OnEnable
See MonoBehaviour.OnEnable.
OnRectTransformDimensionsChange
This callback is called if an associated RectTransform has its
dimensions changed.
OnTransformParentChanged
See MonoBehaviour.OnRectTransformParentChanged.
OnValidate
See MonoBehaviour.OnValidate.
Reset
See MonoBehaviour.Reset.
Start
See MonoBehaviour.Start.
Static Methods
print
Logs message to the Unity Console (identical to Debug.Log).
Destroy
Removes a gameobject, component or asset.
DestroyImmediate
Destroys the object obj immediately. You are strongly recommended to use Destroy
instead.
DontDestroyOnLoad
Makes the object target not be destroyed automatically when loading a new Scene.
FindObjectOfType
Returns the rst active loaded object of Type type.
FindObjectsOfType
Returns a list of all active loaded objects of Type type.
Instantiate
Clones the object original and returns the clone.
Operators
bool
Does the object exist?
operator !=
Compares if two objects refer to a di erent object.
operator ==
Compares two object references to see if they refer to the same object.
Messages
Awake
Awake is called when the script instance is being loaded.
FixedUpdate
This function is called every xed framerate frame, if the
MonoBehaviour is enabled.
LateUpdate
LateUpdate is called every frame, if the Behaviour is enabled.
OnAnimatorIK
Callback for setting up animation IK (inverse kinematics).
OnAnimatorMove
Callback for processing animation movements for modifying root
motion.
OnApplicationFocus
Sent to all GameObjects when the player gets or loses focus.
OnApplicationPause
Sent to all GameObjects when the application pauses.
OnApplicationQuit
Sent to all game objects before the application quits.
OnAudioFilterRead
If OnAudioFilterRead is implemented, Unity will insert a custom lter
into the audio DSP chain.
OnBecameInvisible
OnBecameInvisible is called when the renderer is no longer visible by
any camera.
OnBecameVisible
OnBecameVisible is called when the renderer became visible by any
camera.
OnCollisionEnter
OnCollisionEnter is called when this collider/rigidbody has begun
touching another rigidbody/collider.
OnCollisionEnter2D
Sent when an incoming collider makes contact with this object's collider
(2D physics only).
OnCollisionExit
OnCollisionExit is called when this collider/rigidbody has stopped
touching another rigidbody/collider.
OnCollisionExit2D
Sent when a collider on another object stops touching this object's
collider (2D physics only).
OnCollisionStay
:ref::OnCollisionStay is called once per frame for every
collider/rigidbody that is touching rigidbody/collider.
OnCollisionStay2D
Sent each frame where a collider on another object is touching this
object's collider (2D physics only).
OnConnectedToServer
Called on the client when you have successfully connected to a server.
OnControllerColliderHit
OnControllerColliderHit is called when the controller hits a collider while
performing a Move.
OnDestroy
Destroying the attached Behaviour will result in the game or Scene
receiving OnDestroy.
OnDisable
This function is called when the behaviour becomes disabled.
OnDisconnectedFromServer
Called on the client when the connection was lost or you disconnected
from the server.
OnDrawGizmos
Implement OnDrawGizmos if you want to draw gizmos that are also
pickable and always drawn.
OnDrawGizmosSelected
Implement OnDrawGizmosSelected to draw a gizmo if the object is
selected.
OnEnable
This function is called when the object becomes enabled and active.
OnFailedToConnect
Called on the client when a connection attempt fails for some reason.
OnFailedToConnectToMasterServer
Called on clients or servers when there is a problem connecting to the
MasterServer.
OnGUI
OnGUI is called for rendering and handling GUI events.
OnJointBreak
Called when a joint attached to the same game object broke.
OnJointBreak2D
Called when a Joint2D attached to the same game object breaks.
OnMasterServerEvent
Called on clients or servers when reporting events from the
MasterServer.
OnMouseDown
OnMouseDown is called when the user has pressed the mouse button
while over the GUIElement or Collider.
OnMouseDrag
OnMouseDrag is called when the user has clicked on a GUIElement or
Collider and is still holding down the mouse.
OnMouseEnter
Called when the mouse enters the GUIElement or Collider.
OnMouseExit
Called when the mouse is not any longer over the GUIElement or
Collider.
OnMouseOver
Called every frame while the mouse is over the GUIElement or Collider.
OnMouseUp
OnMouseUp is called when the user has released the mouse button.
OnMouseUpAsButton
OnMouseUpAsButton is only called when the mouse is released over
the same GUIElement or Collider as it was pressed.
OnNetworkInstantiate
Called on objects which have been network instantiated with
Network.Instantiate.
OnParticleCollision
OnParticleCollision is called when a particle hits a Collider.
OnParticleSystemStopped
OnParticleSystemStopped is called when all particles in the system have
died, and no new particles will be born. New particles cease to be
created either after Stop is called, or when the duration property of a
non-looping system has been exceeded.
OnParticleTrigger
OnParticleTrigger is called when any particles in a particle system meet
the conditions in the trigger module.
OnPlayerConnected
Called on the server whenever a new player has successfully connected.
OnPlayerDisconnected
Called on the server whenever a player disconnected from the server.
OnPostRender
OnPostRender is called after a camera nished rendering the Scene.
OnPreCull
OnPreCull is called before a camera culls the Scene.
OnPreRender
OnPreRender is called before a camera starts rendering the Scene.
OnRenderImage
OnRenderImage is called after all rendering is complete to render
image.
OnRenderObject
OnRenderObject is called after camera has rendered the Scene.
OnSerializeNetworkView
Used to customize synchronization of variables in a script watched by a
network view.
OnServerInitialized
Called on the server whenever a Network.InitializeServer was invoked
and has completed.
OnTransformChildrenChanged
This function is called when the list of children of the transform of the
GameObject has changed.
OnTransformParentChanged
This function is called when the parent property of the transform of the
GameObject has changed.
OnTriggerEnter
OnTriggerEnter is called when the Collider other enters the trigger.
OnTriggerEnter2D
Sent when another object enters a trigger collider attached to this
object (2D physics only).
OnTriggerExit
OnTriggerExit is called when the Collider other has stopped touching
the trigger.
OnTriggerExit2D
Sent when another object leaves a trigger collider attached to this
object (2D physics only).
OnTriggerStay
OnTriggerStay is called once per physics update for every Collider other
that is touching the trigger.
OnTriggerStay2D
Sent each frame where another object is within a trigger collider
attached to this object (2D physics only).
OnValidate
This function is called when the script is loaded or a value is changed in
the inspector (Called in the editor only).
OnWillRenderObject
OnWillRenderObject is called for each camera if the object is visible and
not a UI element.
Reset
Reset to default values.
Start
Start is called on the frame when a script is enabled just before any of
the Update methods are called the rst time.
Update
Update is called every frame, if the MonoBehaviour is enabled.
Leave feedback
Description
Event payload associated with pointer (mouse / touch) events.
Properties
button
The InputButton for this event.
clickCount
Number of clicks in a row.
clickTime
The last time a click event was sent.
delta
Pointer delta since last update.
dragging
Is a drag operation currently occuring.
enterEventCamera
The camera associated with the last OnPointerEnter event.
hovered
List of objects in the hover stack.
lastPress
The GameObject for the last press event.
pointerCurrentRaycast
RaycastResult associated with the current event.
pointerDrag
The object that is receiving OnDrag.
pointerEnter
The object that received 'OnPointerEnter'.
pointerId
Identi cation of the pointer.
pointerPress
The GameObject that received the OnPointerDown.
pointerPressRaycast
RaycastResult associated with the pointer press.
position
Current pointer position.
pressEventCamera
The camera associated with the last OnPointerPress event.
pressPosition
The screen space coordinates of the last pointer click.
rawPointerPress
The object that the press happened on even if it can not handle the press event.
scrollDelta
The amount of scroll since the last update.
useDragThreshold
Should a drag threshold be used?
Public Methods
IsPointerMoving
Is the pointer moving.
IsScrolling
Is scroll being used on the input device.
Inherited Members
Properties
used
Is the event used?
currentInputModule
A reference to the BaseInputModule that sent this event.
selectedObject
The object currently considered selected by the EventSystem.
Public Methods
Reset
Reset the event.
Use
Use the event.
Leave feedback
Description
The state of a press for the given frame.
Properties
Pressed
Button was pressed this frame.
Released
Button was released this frame.
PressedAndReleased
Button was pressed and released this frame.
NotChanged
Same as last frame.
Leave feedback
Description
Input press tracking.
Properties
Left
Left button.
Right
Right button.
Middle
Middle button.
Leave feedback
Description
A BaseInputModule for pointer input.
Used by TouchInputModule and StandaloneInputModule.
Static Properties
kFakeTouchesId
Touch id for when simulating touches on a non touch device.
kMouseLeftId
Id of the cached left mouse pointer event.
kMouseMiddleId
Id of the cached middle mouse pointer event.
kMouseRightId
Id of the cached right mouse pointer event.
Protected Methods
ClearSelection
Clear all pointers and deselect any selected objects in the EventSystem.
CopyFromTo
Copy one PointerEventData to another.
DeselectIfSelectionChanged
Deselect the current selected GameObject if the currently pointed-at
GameObject is di erent.
GetLastPointerEventData
Return the last PointerEventData for the given touch / mouse id.
GetMousePointerEventData
Return the current MouseState.
GetPointerData
Search the cache for currently active pointers, return true if found.
GetTouchPointerEventData
Given a touch populate the PointerEventData and return if we are pressed or
released.
ProcessDrag
Process the drag for the current frame with the given pointer event.
ProcessMove
Process movement for the current frame with the given pointer event.
RemovePointerData
Remove the PointerEventData from the cache.
StateForMouseButton
Given a mouse button return the current state for the frame.
Inherited Members
Properties
input
The current BaseInput being used by the input module.
inputOverride
Used to override the default BaseInput for the input module.
enabled
Enabled Behaviours are Updated, disabled Behaviours are not.
isActiveAndEnabled
Has the Behaviour had active and enabled called?
gameObject
The game object this component is attached to. A component is always attached to a
game object.
tag
The tag of this game object.
transform
The Transform attached to this GameObject.
runInEditMode
Allow a speci c instance of a MonoBehaviour to run in edit mode (only available in the
editor).
useGUILayout
Disabling this lets you skip the GUI layout phase.
hideFlags
Should the object be hidden, saved with the Scene or modi able by the user?
name
The name of the object.
Public Methods
ActivateModule
Called when the module is activated. Override this if you want custom code to
execute when you activate your module.
DeactivateModule
Called when the module is deactivated. Override this if you want custom code to
execute when you deactivate your module.
IsModuleSupported
Check to see if the module is supported. Override this if you have a platfrom
speci c module (eg. TouchInputModule that you do not want to activate on
standalone.
IsPointerOverGameObject
Is the pointer with the given ID over an EventSystem object?
Process
Process the current tick for the module.
ShouldActivateModule
Should be activated.
UpdateModule
Update the internal state of the Module.
BroadcastMessage
Calls the method named methodName on every MonoBehaviour in this game
object or any of its children.
CompareTag
Is this game object tagged with tag ?
GetComponent
Returns the component of Type type if the game object has one attached, null if
it doesn't.
GetComponentInChildren
Returns the component of Type type in the GameObject or any of its children
using depth rst search.
GetComponentInParent
Returns the component of Type type in the GameObject or any of its parents.
GetComponents
Returns all components of Type type in the GameObject.
GetComponentsInChildren
Returns all components of Type type in the GameObject or any of its children.
GetComponentsInParent
Returns all components of Type type in the GameObject or any of its parents.
SendMessage
Calls the method named methodName on every MonoBehaviour in this game
object.
SendMessageUpwards
Calls the method named methodName on every MonoBehaviour in this game
object and on every ancestor of the behaviour.
CancelInvoke
Cancels all Invoke calls on this MonoBehaviour.
Invoke
Invokes the method methodName in time seconds.
InvokeRepeating
Invokes the method methodName in time seconds, then repeatedly every
repeatRate seconds.
IsInvoking
Is any invoke on methodName pending?
StartCoroutine
Starts a coroutine.
StopAllCoroutines
Stops all coroutines running on this behaviour.
StopCoroutine
Stops the rst coroutine named methodName, or the coroutine stored in routine
running on this behaviour.
GetInstanceID
Returns the instance id of the object.
ToString
Returns the name of the GameObject.
IsActive
Returns true if the GameObject and the Component are active.
IsDestroyed
Returns true if the native representation of the behaviour has been destroyed.
Protected Methods
GetAxisEventData
Given some input data generate an AxisEventData that can be used by
the event system.
GetBaseEventData
Generate a BaseEventData that can be used by the EventSystem.
HandlePointerExitAndEnter
Handle sending enter and exit events when a new enter target is
found.
OnDisable
See MonoBehaviour.OnDisable.
OnEnable
See MonoBehaviour.OnEnable.
Awake
See MonoBehaviour.Awake.
OnBeforeTransformParentChanged
See MonoBehaviour.OnBeforeTransformParentChanged.
OnCanvasGroupChanged
See MonoBehaviour.OnCanvasGroupChanged.
OnCanvasHierarchyChanged
Called when the state of the parent Canvas is changed.
OnDestroy
See MonoBehaviour.OnDestroy.
OnDidApplyAnimationProperties
See LayoutGroup.OnDidApplyAnimationProperties.
OnDisable
See MonoBehaviour.OnDisable.
OnEnable
See MonoBehaviour.OnEnable.
OnRectTransformDimensionsChange
This callback is called if an associated RectTransform has its
dimensions changed.
OnTransformParentChanged
See MonoBehaviour.OnRectTransformParentChanged.
OnValidate
See MonoBehaviour.OnValidate.
Reset
See MonoBehaviour.Reset.
Start
See MonoBehaviour.Start.
Static Methods
DetermineMoveDirection
Given an input movement, determine the best MoveDirection.
FindCommonRoot
Given 2 GameObjects, return a common root GameObject (or null).
FindFirstRaycast
Return the rst valid RaycastResult.
print
Logs message to the Unity Console (identical to Debug.Log).
Destroy
Removes a gameobject, component or asset.
DestroyImmediate
Destroys the object obj immediately. You are strongly recommended to use
Destroy instead.
DontDestroyOnLoad
Makes the object target not be destroyed automatically when loading a new
Scene.
FindObjectOfType
Returns the rst active loaded object of Type type.
FindObjectsOfType
Returns a list of all active loaded objects of Type type.
Instantiate
Clones the object original and returns the clone.
Operators
bool
Does the object exist?
operator !=
Compares if two objects refer to a di erent object.
operator ==
Compares two object references to see if they refer to the same object.
Messages
Awake
Awake is called when the script instance is being loaded.
FixedUpdate
This function is called every xed framerate frame, if the
MonoBehaviour is enabled.
LateUpdate
LateUpdate is called every frame, if the Behaviour is enabled.
OnAnimatorIK
Callback for setting up animation IK (inverse kinematics).
OnAnimatorMove
Callback for processing animation movements for modifying root
motion.
OnApplicationFocus
Sent to all GameObjects when the player gets or loses focus.
OnApplicationPause
Sent to all GameObjects when the application pauses.
OnApplicationQuit
Sent to all game objects before the application quits.
OnAudioFilterRead
If OnAudioFilterRead is implemented, Unity will insert a custom lter
into the audio DSP chain.
OnBecameInvisible
OnBecameInvisible is called when the renderer is no longer visible by
any camera.
OnBecameVisible
OnBecameVisible is called when the renderer became visible by any
camera.
OnCollisionEnter
OnCollisionEnter is called when this collider/rigidbody has begun
touching another rigidbody/collider.
OnCollisionEnter2D
Sent when an incoming collider makes contact with this object's collider
(2D physics only).
OnCollisionExit
OnCollisionExit is called when this collider/rigidbody has stopped
touching another rigidbody/collider.
OnCollisionExit2D
Sent when a collider on another object stops touching this object's
collider (2D physics only).
OnCollisionStay
:ref::OnCollisionStay is called once per frame for every
collider/rigidbody that is touching rigidbody/collider.
OnCollisionStay2D
Sent each frame where a collider on another object is touching this
object's collider (2D physics only).
OnConnectedToServer
Called on the client when you have successfully connected to a server.
OnControllerColliderHit
OnControllerColliderHit is called when the controller hits a collider while
performing a Move.
OnDestroy
Destroying the attached Behaviour will result in the game or Scene
receiving OnDestroy.
OnDisable
This function is called when the behaviour becomes disabled.
OnDisconnectedFromServer
Called on the client when the connection was lost or you disconnected
from the server.
OnDrawGizmos
Implement OnDrawGizmos if you want to draw gizmos that are also
pickable and always drawn.
OnDrawGizmosSelected
Implement OnDrawGizmosSelected to draw a gizmo if the object is
selected.
OnEnable
This function is called when the object becomes enabled and active.
OnFailedToConnect
Called on the client when a connection attempt fails for some reason.
OnFailedToConnectToMasterServer
Called on clients or servers when there is a problem connecting to the
MasterServer.
OnGUI
OnGUI is called for rendering and handling GUI events.
OnJointBreak
Called when a joint attached to the same game object broke.
OnJointBreak2D
Called when a Joint2D attached to the same game object breaks.
OnMasterServerEvent
Called on clients or servers when reporting events from the
MasterServer.
OnMouseDown
OnMouseDown is called when the user has pressed the mouse button
while over the GUIElement or Collider.
OnMouseDrag
OnMouseDrag is called when the user has clicked on a GUIElement or
Collider and is still holding down the mouse.
OnMouseEnter
Called when the mouse enters the GUIElement or Collider.
OnMouseExit
Called when the mouse is not any longer over the GUIElement or
Collider.
OnMouseOver
Called every frame while the mouse is over the GUIElement or Collider.
OnMouseUp
OnMouseUp is called when the user has released the mouse button.
OnMouseUpAsButton
OnMouseUpAsButton is only called when the mouse is released over
the same GUIElement or Collider as it was pressed.
OnNetworkInstantiate
Called on objects which have been network instantiated with
Network.Instantiate.
OnParticleCollision
OnParticleCollision is called when a particle hits a Collider.
OnParticleSystemStopped
OnParticleSystemStopped is called when all particles in the system have
died, and no new particles will be born. New particles cease to be
created either after Stop is called, or when the duration property of a
non-looping system has been exceeded.
OnParticleTrigger
OnParticleTrigger is called when any particles in a particle system meet
the conditions in the trigger module.
OnPlayerConnected
Called on the server whenever a new player has successfully connected.
OnPlayerDisconnected
Called on the server whenever a player disconnected from the server.
OnPostRender
OnPostRender is called after a camera nished rendering the Scene.
OnPreCull
OnPreCull is called before a camera culls the Scene.
OnPreRender
OnPreRender is called before a camera starts rendering the Scene.
OnRenderImage
OnRenderImage is called after all rendering is complete to render
image.
OnRenderObject
OnRenderObject is called after camera has rendered the Scene.
OnSerializeNetworkView
Used to customize synchronization of variables in a script watched by a
network view.
OnServerInitialized
Called on the server whenever a Network.InitializeServer was invoked
and has completed.
OnTransformChildrenChanged
This function is called when the list of children of the transform of the
GameObject has changed.
OnTransformParentChanged
This function is called when the parent property of the transform of the
GameObject has changed.
OnTriggerEnter
OnTriggerEnter is called when the Collider other enters the trigger.
OnTriggerEnter2D
Sent when another object enters a trigger collider attached to this
object (2D physics only).
OnTriggerExit
OnTriggerExit is called when the Collider other has stopped touching
the trigger.
OnTriggerExit2D
Sent when another object leaves a trigger collider attached to this
object (2D physics only).
OnTriggerStay
OnTriggerStay is called once per physics update for every Collider other
that is touching the trigger.
OnTriggerStay2D
Sent each frame where another object is within a trigger collider
attached to this object (2D physics only).
OnValidate
This function is called when the script is loaded or a value is changed in
the inspector (Called in the editor only).
OnWillRenderObject
OnWillRenderObject is called for each camera if the object is visible and
not a UI element.
Reset
Reset to default values.
Start
Start is called on the frame when a script is enabled just before any of
the Update methods are called the rst time.
Update
Update is called every frame, if the MonoBehaviour is enabled.
Leave feedback
Description
Information about a mouse button event.
Properties
buttonData
Pointer data associated with the mouse event.
buttonState
The state of the button this frame.
Public Methods
PressedThisFrame
Was the button pressed this frame?
ReleasedThisFrame
Was the button released this frame?
Leave feedback
Description
A hit result from a BaseRaycaster.
Properties
depth
The relative depth of the element.
distance
Distance to the hit.
gameObject
The GameObject that was hit by the raycast.
index
Hit index.
isValid
Is there an associated module and a hit GameObject.
module
BaseInputModule that raised the hit.
screenPosition
The screen position from which the raycast was generated.
sortingLayer
The SortingLayer of the hit object.
sortingOrder
The SortingOrder for the hit object.
worldNormal
The normal at the hit location of the raycast.
worldPosition
The world position of the where the raycast has hit.
Public Methods
Clear
Reset the result.
Leave feedback
Description
A BaseInputModule designed for mouse / keyboard / controller input.
Input module for working with, mouse, keyboard, or controller.
Properties
cancelButton
Input manager name for the 'cancel' button.
forceModuleActive
Force this module to be active.
horizontalAxis
Input manager name for the horizontal axis button.
inputActionsPerSecond
Number of keyboard / controller inputs allowed per second.
repeatDelay
Delay in seconds before the input actions per second repeat rate takes e ect.
submitButton
Maximum number of input events handled per second.
verticalAxis
Input manager name for the vertical axis.
Public Methods
ActivateModule
See BaseInputModule.
DeactivateModule
See BaseInputModule.
IsModuleSupported
See BaseInputModule.
Process
See BaseInputModule.
ShouldActivateModule
See BaseInputModule.
UpdateModule
See BaseInputModule.
Protected Methods
ProcessMouseEvent
Iterate through all the di erent mouse events.
ProcessMousePress
Calculate and process any mouse button state changes.
ProcessTouchPress
This method is called by Unity whenever a touch event is processed.
Override this method with a custom implementation to process touch
events yourself.
SendMoveEventToSelectedObject
Calculate and send a move event to the current selected object.
SendSubmitEventToSelectedObject
Calculate and send a submit event to the current selected object.
SendUpdateEventToSelectedObject
Send a update event to the currently selected object.
Inherited Members
Static Properties
kFakeTouchesId
Touch id for when simulating touches on a non touch device.
kMouseLeftId
Id of the cached left mouse pointer event.
kMouseMiddleId
Id of the cached middle mouse pointer event.
kMouseRightId
Id of the cached right mouse pointer event.
Properties
input
The current BaseInput being used by the input module.
inputOverride
Used to override the default BaseInput for the input module.
enabled
Enabled Behaviours are Updated, disabled Behaviours are not.
isActiveAndEnabled
Has the Behaviour had active and enabled called?
gameObject
The game object this component is attached to. A component is always attached to a
game object.
tag
The tag of this game object.
transform
The Transform attached to this GameObject.
runInEditMode
Allow a speci c instance of a MonoBehaviour to run in edit mode (only available in the
editor).
useGUILayout
Disabling this lets you skip the GUI layout phase.
hideFlags
Should the object be hidden, saved with the Scene or modi able by the user?
name
The name of the object.
Public Methods
IsPointerOverGameObject
Is the pointer with the given ID over an EventSystem object?
BroadcastMessage
Calls the method named methodName on every MonoBehaviour in this game
object or any of its children.
CompareTag
Is this game object tagged with tag ?
GetComponent
Returns the component of Type type if the game object has one attached, null if
it doesn't.
GetComponentInChildren
Returns the component of Type type in the GameObject or any of its children
using depth rst search.
GetComponentInParent
Returns the component of Type type in the GameObject or any of its parents.
GetComponents
Returns all components of Type type in the GameObject.
GetComponentsInChildren
Returns all components of Type type in the GameObject or any of its children.
GetComponentsInParent
Returns all components of Type type in the GameObject or any of its parents.
SendMessage
Calls the method named methodName on every MonoBehaviour in this game
object.
SendMessageUpwards
Calls the method named methodName on every MonoBehaviour in this game
object and on every ancestor of the behaviour.
CancelInvoke
Cancels all Invoke calls on this MonoBehaviour.
Invoke
Invokes the method methodName in time seconds.
InvokeRepeating
Invokes the method methodName in time seconds, then repeatedly every
repeatRate seconds.
IsInvoking
Is any invoke on methodName pending?
StartCoroutine
Starts a coroutine.
StopAllCoroutines
Stops all coroutines running on this behaviour.
StopCoroutine
Stops the rst coroutine named methodName, or the coroutine stored in routine
running on this behaviour.
GetInstanceID
Returns the instance id of the object.
ToString
Returns the name of the GameObject.
IsActive
Returns true if the GameObject and the Component are active.
IsDestroyed
Returns true if the native representation of the behaviour has been destroyed.
Protected Methods
GetAxisEventData
Given some input data generate an AxisEventData that can be used by
the event system.
GetBaseEventData
Generate a BaseEventData that can be used by the EventSystem.
HandlePointerExitAndEnter
Handle sending enter and exit events when a new enter target is
found.
OnDisable
See MonoBehaviour.OnDisable.
OnEnable
See MonoBehaviour.OnEnable.
ClearSelection
Clear all pointers and deselect any selected objects in the
EventSystem.
CopyFromTo
Copy one PointerEventData to another.
DeselectIfSelectionChanged
Deselect the current selected GameObject if the currently pointed-at
GameObject is di erent.
GetLastPointerEventData
Return the last PointerEventData for the given touch / mouse id.
GetMousePointerEventData
Return the current MouseState.
GetPointerData
Search the cache for currently active pointers, return true if found.
GetTouchPointerEventData
Given a touch populate the PointerEventData and return if we are
pressed or released.
ProcessDrag
Process the drag for the current frame with the given pointer event.
ProcessMove
Process movement for the current frame with the given pointer event.
RemovePointerData
Remove the PointerEventData from the cache.
StateForMouseButton
Given a mouse button return the current state for the frame.
Awake
See MonoBehaviour.Awake.
OnBeforeTransformParentChanged
See MonoBehaviour.OnBeforeTransformParentChanged.
OnCanvasGroupChanged
See MonoBehaviour.OnCanvasGroupChanged.
OnCanvasHierarchyChanged
Called when the state of the parent Canvas is changed.
OnDestroy
See MonoBehaviour.OnDestroy.
OnDidApplyAnimationProperties
See LayoutGroup.OnDidApplyAnimationProperties.
OnDisable
See MonoBehaviour.OnDisable.
OnEnable
See MonoBehaviour.OnEnable.
OnRectTransformDimensionsChange
This callback is called if an associated RectTransform has its
dimensions changed.
OnTransformParentChanged
See MonoBehaviour.OnRectTransformParentChanged.
OnValidate
See MonoBehaviour.OnValidate.
Reset
See MonoBehaviour.Reset.
Start
See MonoBehaviour.Start.
Static Methods
DetermineMoveDirection
Given an input movement, determine the best MoveDirection.
FindCommonRoot
Given 2 GameObjects, return a common root GameObject (or null).
FindFirstRaycast
Return the rst valid RaycastResult.
print
Logs message to the Unity Console (identical to Debug.Log).
Destroy
Removes a gameobject, component or asset.
DestroyImmediate
Destroys the object obj immediately. You are strongly recommended to use
Destroy instead.
DontDestroyOnLoad
Makes the object target not be destroyed automatically when loading a new
Scene.
FindObjectOfType
Returns the rst active loaded object of Type type.
FindObjectsOfType
Returns a list of all active loaded objects of Type type.
Instantiate
Clones the object original and returns the clone.
Operators
bool
Does the object exist?
operator !=
Compares if two objects refer to a di erent object.
operator ==
Compares two object references to see if they refer to the same object.
Messages
Awake
Awake is called when the script instance is being loaded.
FixedUpdate
This function is called every xed framerate frame, if the
MonoBehaviour is enabled.
LateUpdate
LateUpdate is called every frame, if the Behaviour is enabled.
OnAnimatorIK
Callback for setting up animation IK (inverse kinematics).
OnAnimatorMove
Callback for processing animation movements for modifying root
motion.
OnApplicationFocus
Sent to all GameObjects when the player gets or loses focus.
OnApplicationPause
Sent to all GameObjects when the application pauses.
OnApplicationQuit
Sent to all game objects before the application quits.
OnAudioFilterRead
If OnAudioFilterRead is implemented, Unity will insert a custom lter
into the audio DSP chain.
OnBecameInvisible
OnBecameInvisible is called when the renderer is no longer visible by
any camera.
OnBecameVisible
OnBecameVisible is called when the renderer became visible by any
camera.
OnCollisionEnter
OnCollisionEnter is called when this collider/rigidbody has begun
touching another rigidbody/collider.
OnCollisionEnter2D
Sent when an incoming collider makes contact with this object's collider
(2D physics only).
OnCollisionExit
OnCollisionExit is called when this collider/rigidbody has stopped
touching another rigidbody/collider.
OnCollisionExit2D
Sent when a collider on another object stops touching this object's
collider (2D physics only).
OnCollisionStay
:ref::OnCollisionStay is called once per frame for every
collider/rigidbody that is touching rigidbody/collider.
OnCollisionStay2D
Sent each frame where a collider on another object is touching this
object's collider (2D physics only).
OnConnectedToServer
Called on the client when you have successfully connected to a server.
OnControllerColliderHit
OnControllerColliderHit is called when the controller hits a collider while
performing a Move.
OnDestroy
Destroying the attached Behaviour will result in the game or Scene
receiving OnDestroy.
OnDisable
This function is called when the behaviour becomes disabled.
OnDisconnectedFromServer
Called on the client when the connection was lost or you disconnected
from the server.
OnDrawGizmos
Implement OnDrawGizmos if you want to draw gizmos that are also
pickable and always drawn.
OnDrawGizmosSelected
Implement OnDrawGizmosSelected to draw a gizmo if the object is
selected.
OnEnable
This function is called when the object becomes enabled and active.
OnFailedToConnect
Called on the client when a connection attempt fails for some reason.
OnFailedToConnectToMasterServer
Called on clients or servers when there is a problem connecting to the
MasterServer.
OnGUI
OnGUI is called for rendering and handling GUI events.
OnJointBreak
Called when a joint attached to the same game object broke.
OnJointBreak2D
Called when a Joint2D attached to the same game object breaks.
OnMasterServerEvent
Called on clients or servers when reporting events from the
MasterServer.
OnMouseDown
OnMouseDown is called when the user has pressed the mouse button
while over the GUIElement or Collider.
OnMouseDrag
OnMouseDrag is called when the user has clicked on a GUIElement or
Collider and is still holding down the mouse.
OnMouseEnter
Called when the mouse enters the GUIElement or Collider.
OnMouseExit
Called when the mouse is not any longer over the GUIElement or
Collider.
OnMouseOver
Called every frame while the mouse is over the GUIElement or Collider.
OnMouseUp
OnMouseUp is called when the user has released the mouse button.
OnMouseUpAsButton
OnMouseUpAsButton is only called when the mouse is released over
the same GUIElement or Collider as it was pressed.
OnNetworkInstantiate
Called on objects which have been network instantiated with
Network.Instantiate.
OnParticleCollision
OnParticleCollision is called when a particle hits a Collider.
OnParticleSystemStopped
OnParticleSystemStopped is called when all particles in the system have
died, and no new particles will be born. New particles cease to be
created either after Stop is called, or when the duration property of a
non-looping system has been exceeded.
OnParticleTrigger
OnParticleTrigger is called when any particles in a particle system meet
the conditions in the trigger module.
OnPlayerConnected
Called on the server whenever a new player has successfully connected.
OnPlayerDisconnected
Called on the server whenever a player disconnected from the server.
OnPostRender
OnPostRender is called after a camera nished rendering the Scene.
OnPreCull
OnPreCull is called before a camera culls the Scene.
OnPreRender
OnPreRender is called before a camera starts rendering the Scene.
OnRenderImage
OnRenderImage is called after all rendering is complete to render
image.
OnRenderObject
OnRenderObject is called after camera has rendered the Scene.
OnSerializeNetworkView
Used to customize synchronization of variables in a script watched by a
network view.
OnServerInitialized
Called on the server whenever a Network.InitializeServer was invoked
and has completed.
OnTransformChildrenChanged
This function is called when the list of children of the transform of the
GameObject has changed.
OnTransformParentChanged
This function is called when the parent property of the transform of the
GameObject has changed.
OnTriggerEnter
OnTriggerEnter is called when the Collider other enters the trigger.
OnTriggerEnter2D
Sent when another object enters a trigger collider attached to this
object (2D physics only).
OnTriggerExit
OnTriggerExit is called when the Collider other has stopped touching
the trigger.
OnTriggerExit2D
Sent when another object leaves a trigger collider attached to this
object (2D physics only).
OnTriggerStay
OnTriggerStay is called once per physics update for every Collider other
that is touching the trigger.
OnTriggerStay2D
Sent each frame where another object is within a trigger collider
attached to this object (2D physics only).
OnValidate
This function is called when the script is loaded or a value is changed in
the inspector (Called in the editor only).
OnWillRenderObject
OnWillRenderObject is called for each camera if the object is visible and
not a UI element.
Reset
Reset to default values.
Start
Start is called on the frame when a script is enabled just before any of
the Update methods are called the rst time.
Update
Update is called every frame, if the MonoBehaviour is enabled.
Leave feedback
Obsolete
Description
Input module used for touch based input.
Inherited Members
Static Properties
kFakeTouchesId
Touch id for when simulating touches on a non touch device.
kMouseLeftId
Id of the cached left mouse pointer event.
kMouseMiddleId
Id of the cached middle mouse pointer event.
kMouseRightId
Id of the cached right mouse pointer event.
Properties
input
The current BaseInput being used by the input module.
inputOverride
Used to override the default BaseInput for the input module.
enabled
Enabled Behaviours are Updated, disabled Behaviours are not.
isActiveAndEnabled
Has the Behaviour had active and enabled called?
gameObject
The game object this component is attached to. A component is always attached to a
game object.
tag
The tag of this game object.
transform
The Transform attached to this GameObject.
runInEditMode
Allow a speci c instance of a MonoBehaviour to run in edit mode (only available in the
editor).
useGUILayout
Disabling this lets you skip the GUI layout phase.
hideFlags
Should the object be hidden, saved with the Scene or modi able by the user?
name
The name of the object.
Public Methods
ActivateModule
Called when the module is activated. Override this if you want custom code to
execute when you activate your module.
DeactivateModule
Called when the module is deactivated. Override this if you want custom code to
execute when you deactivate your module.
IsModuleSupported
Check to see if the module is supported. Override this if you have a platfrom
speci c module (eg. TouchInputModule that you do not want to activate on
standalone.
IsPointerOverGameObject
Is the pointer with the given ID over an EventSystem object?
Process
Process the current tick for the module.
ShouldActivateModule
Should be activated.
UpdateModule
Update the internal state of the Module.
BroadcastMessage
Calls the method named methodName on every MonoBehaviour in this game
object or any of its children.
CompareTag
Is this game object tagged with tag ?
GetComponent
Returns the component of Type type if the game object has one attached, null if
it doesn't.
GetComponentInChildren
Returns the component of Type type in the GameObject or any of its children
using depth rst search.
GetComponentInParent
Returns the component of Type type in the GameObject or any of its parents.
GetComponents
Returns all components of Type type in the GameObject.
GetComponentsInChildren
Returns all components of Type type in the GameObject or any of its children.
GetComponentsInParent
Returns all components of Type type in the GameObject or any of its parents.
SendMessage
Calls the method named methodName on every MonoBehaviour in this game
object.
SendMessageUpwards
Calls the method named methodName on every MonoBehaviour in this game
object and on every ancestor of the behaviour.
CancelInvoke
Cancels all Invoke calls on this MonoBehaviour.
Invoke
Invokes the method methodName in time seconds.
InvokeRepeating
Invokes the method methodName in time seconds, then repeatedly every
repeatRate seconds.
IsInvoking
Is any invoke on methodName pending?
StartCoroutine
Starts a coroutine.
StopAllCoroutines
Stops all coroutines running on this behaviour.
StopCoroutine
Stops the rst coroutine named methodName, or the coroutine stored in routine
running on this behaviour.
GetInstanceID
Returns the instance id of the object.
ToString
Returns the name of the GameObject.
IsActive
Returns true if the GameObject and the Component are active.
IsDestroyed
Returns true if the native representation of the behaviour has been destroyed.
Protected Methods
GetAxisEventData
Given some input data generate an AxisEventData that can be used by
the event system.
GetBaseEventData
Generate a BaseEventData that can be used by the EventSystem.
HandlePointerExitAndEnter
Handle sending enter and exit events when a new enter target is
found.
OnDisable
See MonoBehaviour.OnDisable.
OnEnable
See MonoBehaviour.OnEnable.
ClearSelection
Clear all pointers and deselect any selected objects in the
EventSystem.
CopyFromTo
Copy one PointerEventData to another.
DeselectIfSelectionChanged
Deselect the current selected GameObject if the currently pointed-at
GameObject is di erent.
GetLastPointerEventData
Return the last PointerEventData for the given touch / mouse id.
GetMousePointerEventData
Return the current MouseState.
GetPointerData
Search the cache for currently active pointers, return true if found.
GetTouchPointerEventData
Given a touch populate the PointerEventData and return if we are
pressed or released.
ProcessDrag
Process the drag for the current frame with the given pointer event.
ProcessMove
Process movement for the current frame with the given pointer event.
RemovePointerData
Remove the PointerEventData from the cache.
StateForMouseButton
Given a mouse button return the current state for the frame.
Awake
See MonoBehaviour.Awake.
OnBeforeTransformParentChanged
See MonoBehaviour.OnBeforeTransformParentChanged.
OnCanvasGroupChanged
See MonoBehaviour.OnCanvasGroupChanged.
OnCanvasHierarchyChanged
Called when the state of the parent Canvas is changed.
OnDestroy
See MonoBehaviour.OnDestroy.
OnDidApplyAnimationProperties
See LayoutGroup.OnDidApplyAnimationProperties.
OnDisable
See MonoBehaviour.OnDisable.
OnEnable
See MonoBehaviour.OnEnable.
OnRectTransformDimensionsChange
This callback is called if an associated RectTransform has its
dimensions changed.
OnTransformParentChanged
See MonoBehaviour.OnRectTransformParentChanged.
OnValidate
See MonoBehaviour.OnValidate.
Reset
See MonoBehaviour.Reset.
Start
See MonoBehaviour.Start.
Static Methods
DetermineMoveDirection
Given an input movement, determine the best MoveDirection.
FindCommonRoot
Given 2 GameObjects, return a common root GameObject (or null).
FindFirstRaycast
Return the rst valid RaycastResult.
print
Logs message to the Unity Console (identical to Debug.Log).
Destroy
Removes a gameobject, component or asset.
DestroyImmediate
Destroys the object obj immediately. You are strongly recommended to use
Destroy instead.
DontDestroyOnLoad
Makes the object target not be destroyed automatically when loading a new
Scene.
FindObjectOfType
Returns the rst active loaded object of Type type.
FindObjectsOfType
Returns a list of all active loaded objects of Type type.
Instantiate
Clones the object original and returns the clone.
Operators
bool
Does the object exist?
operator !=
Compares if two objects refer to a di erent object.
operator ==
Compares two object references to see if they refer to the same object.
Messages
Awake
Awake is called when the script instance is being loaded.
FixedUpdate
This function is called every xed framerate frame, if the
MonoBehaviour is enabled.
LateUpdate
LateUpdate is called every frame, if the Behaviour is enabled.
OnAnimatorIK
Callback for setting up animation IK (inverse kinematics).
OnAnimatorMove
Callback for processing animation movements for modifying root
motion.
OnApplicationFocus
Sent to all GameObjects when the player gets or loses focus.
OnApplicationPause
Sent to all GameObjects when the application pauses.
OnApplicationQuit
Sent to all game objects before the application quits.
OnAudioFilterRead
If OnAudioFilterRead is implemented, Unity will insert a custom lter
into the audio DSP chain.
OnBecameInvisible
OnBecameInvisible is called when the renderer is no longer visible by
any camera.
OnBecameVisible
OnBecameVisible is called when the renderer became visible by any
camera.
OnCollisionEnter
OnCollisionEnter is called when this collider/rigidbody has begun
touching another rigidbody/collider.
OnCollisionEnter2D
Sent when an incoming collider makes contact with this object's collider
(2D physics only).
OnCollisionExit
OnCollisionExit is called when this collider/rigidbody has stopped
touching another rigidbody/collider.
OnCollisionExit2D
Sent when a collider on another object stops touching this object's
collider (2D physics only).
OnCollisionStay
:ref::OnCollisionStay is called once per frame for every
collider/rigidbody that is touching rigidbody/collider.
OnCollisionStay2D
Sent each frame where a collider on another object is touching this
object's collider (2D physics only).
OnConnectedToServer
Called on the client when you have successfully connected to a server.
OnControllerColliderHit
OnControllerColliderHit is called when the controller hits a collider while
performing a Move.
OnDestroy
Destroying the attached Behaviour will result in the game or Scene
receiving OnDestroy.
OnDisable
This function is called when the behaviour becomes disabled.
OnDisconnectedFromServer
Called on the client when the connection was lost or you disconnected
from the server.
OnDrawGizmos
Implement OnDrawGizmos if you want to draw gizmos that are also
pickable and always drawn.
OnDrawGizmosSelected
Implement OnDrawGizmosSelected to draw a gizmo if the object is
selected.
OnEnable
This function is called when the object becomes enabled and active.
OnFailedToConnect
Called on the client when a connection attempt fails for some reason.
OnFailedToConnectToMasterServer
Called on clients or servers when there is a problem connecting to the
MasterServer.
OnGUI
OnGUI is called for rendering and handling GUI events.
OnJointBreak
Called when a joint attached to the same game object broke.
OnJointBreak2D
Called when a Joint2D attached to the same game object breaks.
OnMasterServerEvent
Called on clients or servers when reporting events from the
MasterServer.
OnMouseDown
OnMouseDown is called when the user has pressed the mouse button
while over the GUIElement or Collider.
OnMouseDrag
OnMouseDrag is called when the user has clicked on a GUIElement or
Collider and is still holding down the mouse.
OnMouseEnter
Called when the mouse enters the GUIElement or Collider.
OnMouseExit
Called when the mouse is not any longer over the GUIElement or
Collider.
OnMouseOver
Called every frame while the mouse is over the GUIElement or Collider.
OnMouseUp
OnMouseUp is called when the user has released the mouse button.
OnMouseUpAsButton
OnMouseUpAsButton is only called when the mouse is released over
the same GUIElement or Collider as it was pressed.
OnNetworkInstantiate
Called on objects which have been network instantiated with
Network.Instantiate.
OnParticleCollision
OnParticleCollision is called when a particle hits a Collider.
OnParticleSystemStopped
OnParticleSystemStopped is called when all particles in the system have
died, and no new particles will be born. New particles cease to be
created either after Stop is called, or when the duration property of a
non-looping system has been exceeded.
OnParticleTrigger
OnParticleTrigger is called when any particles in a particle system meet
the conditions in the trigger module.
OnPlayerConnected
Called on the server whenever a new player has successfully connected.
OnPlayerDisconnected
Called on the server whenever a player disconnected from the server.
OnPostRender
OnPostRender is called after a camera nished rendering the Scene.
OnPreCull
OnPreCull is called before a camera culls the Scene.
OnPreRender
OnPreRender is called before a camera starts rendering the Scene.
OnRenderImage
OnRenderImage is called after all rendering is complete to render
image.
OnRenderObject
OnRenderObject is called after camera has rendered the Scene.
OnSerializeNetworkView
Used to customize synchronization of variables in a script watched by a
network view.
OnServerInitialized
Called on the server whenever a Network.InitializeServer was invoked
and has completed.
OnTransformChildrenChanged
This function is called when the list of children of the transform of the
GameObject has changed.
OnTransformParentChanged
This function is called when the parent property of the transform of the
GameObject has changed.
OnTriggerEnter
OnTriggerEnter is called when the Collider other enters the trigger.
OnTriggerEnter2D
Sent when another object enters a trigger collider attached to this
object (2D physics only).
OnTriggerExit
OnTriggerExit is called when the Collider other has stopped touching
the trigger.
OnTriggerExit2D
Sent when another object leaves a trigger collider attached to this
object (2D physics only).
OnTriggerStay
OnTriggerStay is called once per physics update for every Collider other
that is touching the trigger.
OnTriggerStay2D
Sent each frame where another object is within a trigger collider
attached to this object (2D physics only).
OnValidate
This function is called when the script is loaded or a value is changed in
the inspector (Called in the editor only).
OnWillRenderObject
OnWillRenderObject is called for each camera if the object is visible and
not a UI element.
Reset
Reset to default values.
Start
Start is called on the frame when a script is enabled just before any of
the Update methods are called the rst time.
Update
Update is called every frame, if the MonoBehaviour is enabled.
Leave feedback
Description
Base behaviour that has protected implementations of Unity lifecycle functions.
Public Methods
IsActive
Returns true if the GameObject and the Component are active.
IsDestroyed
Returns true if the native representation of the behaviour has been destroyed.
Protected Methods
Awake
See MonoBehaviour.Awake.
OnBeforeTransformParentChanged
See MonoBehaviour.OnBeforeTransformParentChanged.
OnCanvasGroupChanged
See MonoBehaviour.OnCanvasGroupChanged.
OnCanvasHierarchyChanged
Called when the state of the parent Canvas is changed.
OnDestroy
See MonoBehaviour.OnDestroy.
OnDidApplyAnimationProperties
See LayoutGroup.OnDidApplyAnimationProperties.
OnDisable
See MonoBehaviour.OnDisable.
OnEnable
See MonoBehaviour.OnEnable.
OnRectTransformDimensionsChange
This callback is called if an associated RectTransform has its
dimensions changed.
OnTransformParentChanged
See MonoBehaviour.OnRectTransformParentChanged.
OnValidate
See MonoBehaviour.OnValidate.
Reset
See MonoBehaviour.Reset.
Start
See MonoBehaviour.Start.
Inherited Members
Properties
enabled
Enabled Behaviours are Updated, disabled Behaviours are not.
isActiveAndEnabled
Has the Behaviour had active and enabled called?
gameObject
The game object this component is attached to. A component is always attached to a
game object.
tag
The tag of this game object.
transform
The Transform attached to this GameObject.
runInEditMode
Allow a speci c instance of a MonoBehaviour to run in edit mode (only available in the
editor).
useGUILayout
Disabling this lets you skip the GUI layout phase.
hideFlags
Should the object be hidden, saved with the Scene or modi able by the user?
name
The name of the object.
Public Methods
BroadcastMessage
Calls the method named methodName on every MonoBehaviour in this game
object or any of its children.
CompareTag
Is this game object tagged with tag ?
GetComponent
Returns the component of Type type if the game object has one attached, null if
it doesn't.
GetComponentInChildren
Returns the component of Type type in the GameObject or any of its children
using depth rst search.
GetComponentInParent
Returns the component of Type type in the GameObject or any of its parents.
GetComponents
Returns all components of Type type in the GameObject.
GetComponentsInChildren
Returns all components of Type type in the GameObject or any of its children.
GetComponentsInParent
Returns all components of Type type in the GameObject or any of its parents.
SendMessage
Calls the method named methodName on every MonoBehaviour in this game
object.
SendMessageUpwards
Calls the method named methodName on every MonoBehaviour in this game
object and on every ancestor of the behaviour.
CancelInvoke
Cancels all Invoke calls on this MonoBehaviour.
Invoke
Invokes the method methodName in time seconds.
InvokeRepeating
Invokes the method methodName in time seconds, then repeatedly every
repeatRate seconds.
IsInvoking
Is any invoke on methodName pending?
StartCoroutine
Starts a coroutine.
StopAllCoroutines
Stops all coroutines running on this behaviour.
StopCoroutine
Stops the rst coroutine named methodName, or the coroutine stored in routine
running on this behaviour.
GetInstanceID
Returns the instance id of the object.
ToString
Returns the name of the GameObject.
Static Methods
print
Logs message to the Unity Console (identical to Debug.Log).
Destroy
Removes a gameobject, component or asset.
DestroyImmediate
Destroys the object obj immediately. You are strongly recommended to use Destroy
instead.
DontDestroyOnLoad
Makes the object target not be destroyed automatically when loading a new Scene.
FindObjectOfType
Returns the rst active loaded object of Type type.
FindObjectsOfType
Returns a list of all active loaded objects of Type type.
Instantiate
Clones the object original and returns the clone.
Operators
bool
Does the object exist?
operator !=
Compares if two objects refer to a di erent object.
operator ==
Compares two object references to see if they refer to the same object.
Messages
FixedUpdate
This function is called every xed framerate frame, if the
MonoBehaviour is enabled.
LateUpdate
LateUpdate is called every frame, if the Behaviour is enabled.
OnAnimatorIK
Callback for setting up animation IK (inverse kinematics).
OnAnimatorMove
Callback for processing animation movements for modifying root
motion.
OnApplicationFocus
Sent to all GameObjects when the player gets or loses focus.
OnApplicationPause
Sent to all GameObjects when the application pauses.
OnApplicationQuit
Sent to all game objects before the application quits.
OnAudioFilterRead
If OnAudioFilterRead is implemented, Unity will insert a custom lter
into the audio DSP chain.
OnBecameInvisible
OnBecameInvisible is called when the renderer is no longer visible by
any camera.
OnBecameVisible
OnBecameVisible is called when the renderer became visible by any
camera.
OnCollisionEnter
OnCollisionEnter is called when this collider/rigidbody has begun
touching another rigidbody/collider.
OnCollisionEnter2D
Sent when an incoming collider makes contact with this object's collider
(2D physics only).
OnCollisionExit
OnCollisionExit is called when this collider/rigidbody has stopped
touching another rigidbody/collider.
OnCollisionExit2D
Sent when a collider on another object stops touching this object's
collider (2D physics only).
OnCollisionStay
:ref::OnCollisionStay is called once per frame for every
collider/rigidbody that is touching rigidbody/collider.
OnCollisionStay2D
Sent each frame where a collider on another object is touching this
object's collider (2D physics only).
OnConnectedToServer
Called on the client when you have successfully connected to a server.
OnControllerColliderHit
OnControllerColliderHit is called when the controller hits a collider while
performing a Move.
OnDisconnectedFromServer
Called on the client when the connection was lost or you disconnected
from the server.
OnDrawGizmos
Implement OnDrawGizmos if you want to draw gizmos that are also
pickable and always drawn.
OnDrawGizmosSelected
Implement OnDrawGizmosSelected to draw a gizmo if the object is
selected.
OnFailedToConnect
Called on the client when a connection attempt fails for some reason.
OnFailedToConnectToMasterServer
Called on clients or servers when there is a problem connecting to the
MasterServer.
OnGUI
OnGUI is called for rendering and handling GUI events.
OnJointBreak
Called when a joint attached to the same game object broke.
OnJointBreak2D
Called when a Joint2D attached to the same game object breaks.
OnMasterServerEvent
Called on clients or servers when reporting events from the
MasterServer.
OnMouseDown
OnMouseDown is called when the user has pressed the mouse button
while over the GUIElement or Collider.
OnMouseDrag
OnMouseDrag is called when the user has clicked on a GUIElement or
Collider and is still holding down the mouse.
OnMouseEnter
Called when the mouse enters the GUIElement or Collider.
OnMouseExit
Called when the mouse is not any longer over the GUIElement or
Collider.
OnMouseOver
Called every frame while the mouse is over the GUIElement or Collider.
OnMouseUp
OnMouseUp is called when the user has released the mouse button.
OnMouseUpAsButton
OnMouseUpAsButton is only called when the mouse is released over
the same GUIElement or Collider as it was pressed.
OnNetworkInstantiate
Called on objects which have been network instantiated with
Network.Instantiate.
OnParticleCollision
OnParticleCollision is called when a particle hits a Collider.
OnParticleSystemStopped
OnParticleSystemStopped is called when all particles in the system have
died, and no new particles will be born. New particles cease to be
created either after Stop is called, or when the duration property of a
non-looping system has been exceeded.
OnParticleTrigger
OnParticleTrigger is called when any particles in a particle system meet
the conditions in the trigger module.
OnPlayerConnected
Called on the server whenever a new player has successfully connected.
OnPlayerDisconnected
Called on the server whenever a player disconnected from the server.
OnPostRender
OnPostRender is called after a camera nished rendering the Scene.
OnPreCull
OnPreCull is called before a camera culls the Scene.
OnPreRender
OnPreRender is called before a camera starts rendering the Scene.
OnRenderImage
OnRenderImage is called after all rendering is complete to render
image.
OnRenderObject
OnRenderObject is called after camera has rendered the Scene.
OnSerializeNetworkView
Used to customize synchronization of variables in a script watched by a
network view.
OnServerInitialized
Called on the server whenever a Network.InitializeServer was invoked
and has completed.
OnTransformChildrenChanged
This function is called when the list of children of the transform of the
GameObject has changed.
OnTriggerEnter
OnTriggerEnter is called when the Collider other enters the trigger.
OnTriggerEnter2D
Sent when another object enters a trigger collider attached to this
object (2D physics only).
OnTriggerExit
OnTriggerExit is called when the Collider other has stopped touching
the trigger.
OnTriggerExit2D
Sent when another object leaves a trigger collider attached to this
object (2D physics only).
OnTriggerStay
OnTriggerStay is called once per physics update for every Collider other
that is touching the trigger.
OnTriggerStay2D
Sent each frame where another object is within a trigger collider
attached to this object (2D physics only).
OnWillRenderObject
OnWillRenderObject is called for each camera if the object is visible and
not a UI element.
Update
Update is called every frame, if the MonoBehaviour is enabled.
Leave feedback
Implements interfaces:IEventSystemHandler
Description
Interface to implement if you wish to receive OnBeginDrag callbacks.
Note: You need to implement IDragHandler in addition to IBeginDragHandler.
See Also: IDragHandler.
Public Methods
OnBeginDrag
Called by a BaseInputModule before a drag is started.
Leave feedback
Implements interfaces:IEventSystemHandler
Description
Interface to implement if you wish to receive OnCancel callbacks.
Public Methods
OnCancel
Called by a BaseInputModule when a Cancel event occurs.
Leave feedback
Implements interfaces:IEventSystemHandler
Description
Interface to implement if you wish to receive OnDeselect callbacks.
Public Methods
OnDeselect
Called by the EventSystem when a new object is being selected.
Leave feedback
Implements interfaces:IEventSystemHandler
Description
Interface to implement if you wish to receive OnDrag callbacks.
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
[RequireComponent(typeof(Image))]
public class DragMe : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDragHa
{
public bool dragOnSurfaces = true;
private GameObject m_DraggingIcon;
private RectTransform m_DraggingPlane;
public void OnBeginDrag(PointerEventData eventData)
{
var canvas = FindInParents