Unity脚本常用API Day03

常用API:Component、Transform、GameObject、Object、Time

1、API(Application Programming Interface):应用程序编程接口,是一些预先定义的函数。

2、Unity引擎提供了丰富的组件和类库,为开发者提供了非常大的便利,熟练掌握和使用这些API对于游戏开发效率提高很重要。

Component:

常用属性:gameObject、transform、collider、renderer......

常用方法:GetComponent、GetComponentInChildren、GetComponentInParent......

Transfrom:

常用属性:position、localPosition、parent、forward......

常用方法:Translate、Rotate、TransformPoint、Find、SetSiblingIndex......

GameObject:

常用属性:transform、activeInHierarchy、activeSelf、tag......

常用方法:AddComponent、Find、FindGameObjectsWithTag、Object.FindObjectOfType......

Object:

常用属性:name......

常用方法:Instantiate、Destroy、FindObjectOfType、FindObjectsOfType......

Time类:

1、从Unity获取时间信息的接口

2、常用属性:

     time:从游戏开始到现在所用时间

     timeScale:时间缩放

     deltaTime:以秒为单位,表示每帧的经过时间

     unscaledDeltaTime:不受缩放影响的每帧经过时间

猜你喜欢

转载自blog.csdn.net/LOVE_Me__/article/details/125462322
今日推荐