[Unity3d] Script script all compiler properties detailed

Source: Internet
Author: User

The Script property is an IDE-based series of compiler properties
JS is accessed using the @script attribute method () in C # with [attribute Method ()] .
There are only 9 ways to access the property:

    • Addcomponentmenu Adding a new menu item to the component
    • ContextMenu Adding context menu content to the components of the current script
    • Executeineditmode allows the current script to update changes in real-time in run mode
    • Hideininspector is a variable that is not displayed at the time of detection, but is instantiated?
    • NonSerialized tag A variable is not serialized?
    • Rpc?
    • Renderbeforequeues attaching a custom render before the entire engine render queue
    • Requirecomponent force a component to be added (qualification must have a component)
    • Serializable serialization of a class

----------------------------------------------------------------------------------------------------------- ----------------------------------------------------
Addcomponentmenu
Usage:
@script addcomponentmenu ("Transform/follow Transform")
Class Followtransform:monobehaviour
{
Use

You can develop your own component classes and add component Instances to the Gameobject menu.
------------------------------------------------------------------------------------
ContextMenu
Usage:
@ContextMenu ("Update waypoints")
function updatewaypoints ()
{
}
Use:

Use the current script to trigger functions running in the development environment with the right-click menu
----------------------------------------------------------------------------------------
Executeineditmode
Usage:
@script Executeineditmode () use:
Enables the current script to update the changes in real time in the run, re-import the script every frame, which can be used for debugging purposes.
----------------------------------------------------------------------------------------
HideininspectorUsage:
@HideInInspector
var p = 5; use:
Is the variable not displayed during detection, but is instantiated??
The specific use is unknown, guessing is not displayed when the script external variable is set, but it will be played to
-------------------------------------------------------------------------------------------
nonserialized
Useful:
Tag a variable is not serialized.
the specific use is unknown, I understand that it will not be changed externally but can keep the public state
-------------------------------------------------------------------------------------------
RPC
What the hell-.-the RPC bazooka? Or is it marked that he is transmitting with RPC protocol? Anyway, the official website has not written anything.
-------------------------------------------------------------------------------------------
renderbeforequeues
Usage:
@RenderBeforeQueues (1000, 2000)
function Onrenderobject (queue:int) {
Do some custom rendering ...
Use
Add a custom render before the engine renders
The concrete usage is unknown, inside can use what thing to render I also do not know, and that parameter I also did not understand, later use to say again
--------------------------------------------------------------------------------------------
requirecomponent
Usage:
JS:
@Script requirecomponent (rigidbody)

C #:
[Requirecomponent (typeof (Rigidbody))]
Useful:
Forces a component to be added to this object, and if it exists, the component is not allowed to be deleted.
-------------------------------------------------------------------------------------------
Serializable
Usage:
JS inherits the object class by default it will be 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;
}

[Unity3d] Script script all compiler properties detailed

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.