[Unity3D] explanation of all compiler attributes of Script, unity3dscript
The Script attribute is a series of IDE-based compiler attributes.
Use @ script Attribute method () for access in JS, and use [attribute method ()] for access in c.
There are only nine attribute access methods:
- AddComponentMenu add new menu items in the Component menu
- ContextMenu add context menu content to the component of the current script
- ExecuteInEditMode allows the current script to update and modify in real time in Running Mode
- HideInInspector is a variable that is not displayed during detection but will be instantiated?
- Does NonSerialized mark that a variable will not be serialized?
- RPC?
- RenderBeforeQueues attaches a custom rendering before the entire engine rendering queue
- RequireComponent forcibly adds a component (a certain component must exist)
- Serializable a class
Certificate ---------------------------------------------------------------------------------------------------------------------------------------------------------------
AddComponentMenu
Usage:
@ Script AddComponentMenu ("Transform/Follow Transform ")
Class FollowTransform: MonoBehaviour
{
} Usage:
You can develop component classes by yourself and add component instances to the GameObject in the menu.
Bytes ------------------------------------------------------------------------------------
ContextMenu
Usage:
@ ContextMenu ("Update Waypoints ")
Function UpdateWaypoints ()
{
}
Usage:
When using the current script, you can use the right-click menu to trigger the function running in the development environment.
Bytes ----------------------------------------------------------------------------------------
ExecuteInEditMode
Usage:
@ Script ExecuteInEditMode () usage:
This allows the current script to be updated and modified in real time during running. The script is re-imported every frame for debugging.
Bytes ----------------------------------------------------------------------------------------
HideInInspectorUsage:
@ HideInInspector
Var p = 5; usage:
Is the variable not displayed during detection, but will be instantiated ??
The specific use is unknown. It is assumed that the external variables of the script will not be displayed but will be used.
Bytes -------------------------------------------------------------------------------------------
NonSerialized
Usage:
Marking a variable is not serialized.
The specific use is unknown. I understand that it will not be changed by the outside, but it can be kept public.
Bytes -------------------------------------------------------------------------------------------
RPC
What's the ghost-.-RPC rocket launcher? Or mark him using the RPC protocol for transmission? Nothing is written on the official website.
Bytes -------------------------------------------------------------------------------------------
RenderBeforeQueues
Usage:
@ RenderBeforeQueues (1000,200 0)
Function OnRenderObject (queue: int ){
// Do some custom rendering...
} Usage:
Add a custom rendering before engine Rendering
The specific usage is unknown. I Don't Know What To render in it, and I still don't know about the parameter. Let's talk about it later.
Bytes --------------------------------------------------------------------------------------------
RequireComponent
Usage:
Js:
@ Script RequireComponent (Rigidbody)
C #:
[RequireComponent (typeof (Rigidbody)]
Usage:
Add a component to this object. If a component exists, the component cannot be deleted.
Bytes -------------------------------------------------------------------------------------------
Serializable
Usage:
The default Object class inherited by js is serialized.
Class Test extends System. Object
{
Var p = 5;
Var c = Color. white;
}
Var test = Test ();
// C # Example
[System. Serializable]
Class Test
{
Public int p = 5;
Public Color c = Color. white;
}