Address: http://blog.csdn.net/dingxiaowei2013/article/details/26215577
Visual Studio 2013 does not provide a smart reminder about monobehaviour's behavior. To write a function, you must complete it all. If you have a good memory, you can start to copy and paste it. I am the latter. I used to write all monobehaviour events as code snippets. After that, all the shortcuts were messy and I couldn't remember them, so I gave up later. To be honest, I have prepared a copy. Remember what you can remember. -------------------------------------------- Lite version (in alphabetical order) awake wake-up cancelinvoke cancel call fixedupdate fixed update invokerepeating repeated call invoke call isinvoking whether to call lateupdate later than update onapplicationfocus when program focus onapplicationpause when program pause onapplicationquit when program exit worker when invisible worker when oncollision oncollisionexit: When you exit the collision oncollisionstay, when you stay in the collision onconnectedtoserver, when you connect to the server oncontrollercolliderhit, When you control the collision Server Ondestroy: When ondisable is destroyed, when unavailable, when disconnected from server, when selected, gizmos ondrawgizmos is drawn. When gizmos onenable is drawn, when available, onfailedtoconnect fails. ongui: onjointbreak when the joint disconnects onlevelwasloadedonlevelwasloaded onmasterserverevent when the master server event onmousedown when the mouse is pressed onmousedrag when the mouse is dragged onmouseenter when the mouse enters onmouseexit when the mouse passes onmouseupasbutton when the mouse is Mouse Onmouseup when the cursor is triggered as a button. When the mouse is started, onnetworkinstantiate when the network instance onparticipant collision when the collision particle occurs. When the player is connected, the player disconnects the onpostrender. After rendering, onprecull indicates that onprerender indicates rendering image onrenderobject when rendering object onserializenetworkview when serializing network view onserverinitialized when server initializes ontriggerenter when entering trigger ontriggerexit When exit trigger ontriggerstay when staying trigger onwillrenderobject print reset startcorouibefore Start stopallcoroutines start stopcoroutines stop all cool stopcoroutinestopcoroutine stop cool Update useguilayout use interface layout detail edition (in execution order) awake call when the current control script instance is loaded. It is generally used to initialize the entire instance. Start is called before the current control script executes update for the first time. Update is executed once every frame. This is the most common event function. Fixedupdate is executed once every fixed frame. Unlike update, fixedupdate is used to render frames. If your rendering efficiency is low, the number of fixedupdate calls will decrease. Fixedupdate is more suitable for computing on the physical engine because it is related to the rendering of each frame. Update is more suitable for control. Lateupdate is called after each frame is executed. It is suitable for Executing command scripts only after all updates are completed. The example on the official website is the follow-up of the camera, which is followed after all update operations. Otherwise, the camera may have been pushed forward, but there is no empty frame of the role in the perspective. Reset is called by clicking the reset button (if any) in the editor mode. You can perform debugging initialization here. Onapplicationfocus is sent to all game objects when the player acquires or loses the focus. It can be used as a collaboration program and yield statements can be used in functions. Onapplicationpause is sent to all game objects when the player is paused. It can be used as a Coordination Program and yield statements can be used in functions. Onapplicationquit sends messages to all game objects before the application exits. Called in the editor when the user stops running mode. When the Web is disabled, it is called in the network player. Onbecameinvisible is called when Renderer (Renderer) is invisible to any camera. Onbecamevisible is called when Renderer (Renderer) is visible on any camera. Oncollisionenter when this collider/Rigidbody triggers another Rigidbody/collider, oncollisionenter will be called. Compared with ontriggerenter, oncollisionenter transmits the collision class instead of collider. Collision includes touch points, collision speed, and other details. If the collision information is not used in the function, the collisioninfo parameter is omitted to avoid unnecessary operations. Note: If the collision body is attached with a non-dynamic rigid body, only collision events are sent. 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. Onconnectedtoserver is called on the client when you successfully connect to the server. Ondisconnectedfromserver is called on the client when the connection is lost or the slave server is disconnected. Onfailedtoconnect is called on the client when a connection fails for some reason. The first two clients of onfailedtoconnecttomasterserver send this message when they are successfully connected to or disconnected from the server. The last two triggers onmasterserverevent when the connection fails and the master server sends a report. Onnetworkinstantiate is called when an object uses network. instantiate for network initialization. This is very useful for disabling or enabling an initialized object component. Their behavior depends on whether they are local or remote. Note: The networkview attribute in networkmessageinfo cannot be used in onnetworkinstantiate. Onplayerconnected is called on the server when a new player connects successfully. Onplayerdisconnected is called on the server when a player is disconnected from the server. When oncontrollercolliderhit is being moved, oncontrollercolliderhit is called when the Controller hits collider. It can be used to push objects when a role encounters an object. Onparticipant lecollision is called when a particle encounters collider. This can be used to apply damage to a game object when it is hit by a particle. This message is sent to all scripts appended to theworldparticipant lecollider and hit collision bodies. This message will be sent only when sendcollisionmessage is enabled in theworldparticle collider view panel. Ondisable this function is called when the object becomes unavailable or inactive. When an object is destroyed, it is called and can be used to clear any code. When the script is re-loaded after compilation, ondisable is called and onenable is called after the script is loaded. Onenable this function is called when the object becomes available or activated. Onenable cannot be used by the cool ondrawgizmos ondrawgizmosselected editor to trigger when gizmos and gizmos are selected. Note: For details about gizmos, refer to my other blog, which is used for self-built components, such as path point painting. Triggered when the ongui is drawn. The GUI menu is usually drawn in this function. Onjointbreak is called when the joints attached to the same object are disconnected onlevelwasloaded when a new level is loaded this function is called onmousedown when the mouse is in guielement (GUI element) or Collider (collision body) onmousedown is called when you click. This event will be sent to all scripts on collider or guielement. Note: This function is invalid on the iPhone. onmousedrag is called when you drag guielement (GUI element) or Collider (collision body. Onmouseenter calls onmouseenter onmouseexit when you move your mouse to guielement or collider. Onmouseover: onmouseover is called when the mouse is suspended on guielement (GUI element) or Collider (collision body. The onmouseup mouse event is triggered when the mouse interacts with the GUI or collider. It must be noted that the drag actually sends this message every frame after the mouse is down and before it is up. Onpostrender: this function is only used for scripts with the host as the camera. This message is triggered when all rendering within the camera range is complete. Onprecull is only used for scripts with the host as the camera. This message is triggered when the camera removes a Rendering scenario. (Not verified) The onprerender function is only used for scripts that host the camera. This message is triggered when the camera starts rendering a scenario. Onrenderimage is triggered when all postprocessing effects (only supported by Pro) of the image are rendered. Onrenderobject is only used for scripts with the host as the camera. Triggered when graphics. drawmeshnow or other functions are used to draw a self-built object after rendering. Onserializenetworkview is used in a network View Script For custom variable synchronization. It automatically determines whether the serialized variable should be sent or received. view the example below for a better description. This depends on who owns the object, such as sending by the owner and receiving by other objects. Onserverinitialized when network. initializeserver is called and completed, this function is called on the server. Ontriggerenter: ontriggerenter is called when Collider (collision body) enters the trigger. The message is sent to the trigger collision body and the rigid body (or the collision body assumes that there is no rigid body ). Note that if the collision body is attached with a rigid body, only trigger events are sent. Ontriggerexit calls ontriggerexit ontriggerstay when Collider (collision body) stops trigger. When the collision body contacts the trigger, ontriggerstay is called at each frame. Onwillrenderobject is called by every camera if the object is visible. This function is not called if monobehaviour is disabled. This function is called during the blanking process and called before rendering all the hidden objects. You can use it to create a dependent texture and update it only when the rendered object is visible. For example, it is already used in water components. Camera. Current will be set as the camera to render this object.