Unity3d: rewrite functions of MonoBehaviour, unitymonobehaviour

Source: Internet
Author: User

[Convert] Unity3d to MonoBehaviour's rewritable function arrangement, unitymonobehaviour
Unity3d unibehaviour rewrite function arrangement

I recently learned about Unity3d. Although many documents have been recorded, I will record it for my convenience later! The following functions play an important role in Unity3d program development.

Update

When MonoBehaviour is enabled, its Update is called at each frame.

LateUpdate

When Behaviour is enabled, its LateUpdate is called at each frame.

FixedUpdate

When MonoBehaviour is enabled, its FixedUpdate is called at each frame.

Awake

Awake is called when a script instance is loaded.

Start

Start is called only before the first call of the Update function.

Reset

Reset to the default value.

OnMouseEnter

OnMouseEnter is called when you move the cursor to GUIElement (GUI element) or Collider (collision body.

OnMouseOver

OnMouseOver is called when the cursor is hovering over GUIElement or Collider.

OnMouseExit

OnMouseExit is called when the cursor is removed from the GUIElement (GUI element) or Collider (collision body.

OnMouseDown

OnMouseDown is called when you click GUIElement or Collider.

OnMouseUp

OnMouseUp is called when you release the mouse button.

OnMouseUpAsButton

OnMouseUpAsButton is called only when the mouse is pressed in the same GUIElement or Collider.

OnMouseDrag

OnMouseDrag is called when you drag GUIElement (GUI element) or Collider (collision body.

OnTriggerEnter

OnTriggerEnter is called when Collider (collision body) enters the trigger.

OnTriggerExit

OnTriggerExit is called when Collider stops trigger.

OnTriggerStay

When the collision body contacts the trigger, OnTriggerStay will be called at each frame.

OnCollisionEnter

When this collider/rigidbody triggers another rigidbody/collider, OnCollisionEnter will be called.

OnCollisionExit

When this collider/rigidbody stops triggering another rigidbody/collider, OnCollisionExit will be called.

OnCollisionStay

When this collider/rigidbody triggers another rigidbody/collider, OnCollisionStay will be called at each frame.

OnControllerColliderHit

When the controller is moved, OnControllerColliderHit is called when the controller hits collider.

OnJointBreak

Called when the joints attached to the same object are disconnected.

Onparticipant lecollision

It is called when a particle encounters collider.

OnBecameVisible

OnBecameVisible is called when renderer (renderer) is visible on any camera.

OnBecameInvisible

OnBecameInvisible is called when renderer (renderer) is invisible to any camera.

OnLevelWasLoaded

This function is called when a new level is loaded.

OnEnable

This function is called when the object becomes available or active.

OnDisable

This function is called when the object becomes unavailable or inactive.

OnDestroy

This function is called when MonoBehaviour is destroyed.

OnPreCull

Called before camera hiding.

OnPreRender

Called before the camera Rendering scenario.

OnPostRender

It is called after the camera completes scene rendering.

OnRenderObject

It is called after rendering in the camera scenario.

OnWillRenderObject

If the object is visible, each camera calls it.

OnGUI

Called when rendering and processing GUI events.

OnRenderImage

It is called after rendering all the images to render the later effects of the images.

OnDrawGizmosSelected

If you want to draw gizmos when an object is selected, execute this function.

OnDrawGizmos

If you want to plot the gizmos that can be clicked, execute this function.

OnApplicationPause

All game objects are sent when the player is paused.

OnApplicationFocus

When a player gets or loses focus, it sends it to all game objects.

OnApplicationQuit

Send to all game objects before exiting the application.

OnPlayerConnected

A new player is called on the server when the connection is successful.

OnServerInitialized

When Network. InitializeServer is called and completed, this function is called on the server.

OnConnectedToServer

When you successfully connect to the server, it is called on the client.

OnPlayerDisconnected

Called on the server when a player is disconnected from the server.

OnDisconnectedFromServer

It is called on the client when the connection is lost or the slave server is disconnected.

OnFailedToConnect

A connection is called on the client when it fails for some reason.

OnFailedToConnectToMasterServer

When an event is reported to an autonomous server, it is called on the client or server.

OnMasterServerEvent

When an event is reported to an autonomous server, it is called on the client or server.

OnNetworkInstantiate

Called when an object uses Network. Instantiate for Network initialization.

OnSerializeNetworkView

In a network View Script, custom variables are used for synchronization.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.