当前位置:网站首页>GameObject class and transform class of unity

GameObject class and transform class of unity

2022-07-05 04:52:00 yaohuiyaoo

  1. 1.GameObject: A class type , All game objects are objects of this type
    2.gameObject: An object , It refers to the game object attached to the script An instance of the current GameObject
    3.Transfrom: Is a class , It is used to describe the size, position, rotation and other information of the object
    4.Transfrom yes Transfrom The object of , Attach to every object
    It is also a component of the current game object ( Every object has this component ). Components of the current GameObject
    5.gameObject.transfrom=this.transfrom=transfrom Get the component of the current game object
    6.Transfrom.gameObject=gameObject=this.gameObject obtain transfrom Of gameObject
    7.GameObject.Find from Scene( head ) Start looking for , according to GameObject Find the name of . Allow to use ”/” Search through the hierarchy , The object must be active active ( By default, it is active )
    8.GameObject.FindWithTag according to tag( label ) Find a gameObject
    9.GameObject.FindGameObjectsWithTag according to Tag Batch Search GameObject
    10.GameObject.FindObjectOfType< Components >(): Find the object that owns the component according to the component , If you find an object of a component , Will find the lowest object that owns the component , When looking for multiple objects with this component , The lowest object with this component will be put into the array first
    11.Transfrom:
    1. You can find hidden objects
    Hidden objects can include any parent node of the lookup path hidden , Child nodes can still (active=flase)
    2. Support path lookup
    3. The premise of finding hidden objects is transfrom The underlying node must be visible, that is active=true
    11.gameObject:
    1.gameObject.name Object name
    2.gameObject.tag Object label
    3.gameObject.layer: Layer of object
    4.gameObject.SetActive(flase); Game object deactivation
    5.gameObject.GetComponent(typeof(T)) , gameObject.GetComponent() Get the components in the game ( Use the output , Can be judged , If there is no such component in the game object, the output is null)
    12. Use object =GetComponent< Components >() You can add components to objects ( Custom components ( Can be a class ) And its own components )
    13. The game object .AddComponent< Components >() Add the component
    14. Components isTrigger The function is to set whether the collision body is a trigger
    15.Vector3(x,y,z): This method is used to set the orientation 1`
    16.Time.deltaTime The number of seconds taken from running to the last second of completion
    17.Invoke( Method , Number of seconds ): How many seconds will it take to call the method
    18.Destory( The game object , Time ): How many seconds to destroy the game object
    19.Rotate: Method of rotating components
原网站

版权声明
本文为[yaohuiyaoo]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202140626299324.html