欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 科技 > 能源 > unity 基本内容

unity 基本内容

2025/3/12 22:16:35 来源:https://blog.csdn.net/weixin_44919646/article/details/141432882  浏览:    关键词:unity 基本内容

unity 基本内容
1.创建对象:CreatePrimitive();
GameObject cube=GameObject.CreatePrimitive(Primitive.Cube); / / 创建一个cube对象
cube.name=“cube1”; / / 设 定 cube 对 象 的 名 宇
Cube.renderer.material.color =Color.red;
2 .克 隆 对 象 :Instantiate(),
GameObject obj=GameObject .Instantiate(cube);
3 . 销 毁 对 象 : Destroy () ;
Destroy (obj,1) ; / / 一 秒 后对 象 消 关
4. 把 脚 本 添 加 到 对 象 上 : cube.Addcomponent(“script”),
5.销 毁 对 象 的 脚 本 : Destroy(cube.Getcomponent(“script”)),
6.GameObject类:
方法:Find() FindWithTag() FindGameObjectWithTag()
7.Time类 属性:deltaTime
Float a=4.0f;
void Update()
{//倒计时
a-=Time.delatTime;
}

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词