- 物体三种方法
GameObject go = new GameObject("cube"); //创建空物体
GameObject.Instantiate(prefab); //根据预制体创建
GameObject.CreatePrimitive(PrimitiveType.Cube); // 根据类型创建对象
- 根据对象新增组件
GameObject go = GameObject.CreatePrimitive(PrimitiveType.Cube);
go.AddComponent<Rigidbody>();//新增刚体组件
go.AddComponent<APIO1EventFunction>(); //新增脚本组件,脚本名:APIO1EventFunction.cs
- 协程的运用
关闭协程