简述unity中Instantiate实例化函数的使用
来源:互联网 发布:sql 默认值绑定到表中 编辑:程序博客网 时间:2024/04/28 14:23
代码:
using UnityEngine;using System.Collections;public class c1 : MonoBehaviour { private int x = 10; private int y = 5; public GameObject cube;void Start () { for(int i=0;i<x;i++) for(int j=0;j<y;j++) { GameObject.Instantiate(cube,new Vector3(i,j,0), Quaternion.identity); }}// Update is called once per framevoid Update () {}}此函数是GameObject类的成员方法,第一个参数是实例化对象,可定义一个public 的gameobject 对象,第二个参数是vector空间坐标,最后一个参数是旋转方式,本例是不旋转。
执行此代码会生成一堵墙壁。当i=0时,对应的是引擎地面的原点,x和y是分别对应的。
0 0
- 简述unity中Instantiate实例化函数的使用
- Unity中Instantiate的用法
- Unity中使用UGUI制作Prefab后,调用Instantiate动态生成Button无法点击的解决方法
- 简述unity中Destory的用法
- Android碎片实例化方法:instantiate的使用及其源码解析
- [Unity3D]预设Prefab与实例Instantiate的基本使用
- 预设prefab和实例Instantiate的基本使用
- 预设Prefab与实例Instantiate的基本使用
- unity3d--预设Prefab与实例Instantiate的基本使用
- Unity中random函数的简单使用
- android+unity3d的Prefabs(预设)与Instantiate(实例化)
- Instantiate 实例
- unity中Instantiate后物体不能显示或者显示非常大的原理及解决方法
- unity中使用SetActive()和gameobject实例化的陷坑总结
- .net中函数的使用实例
- Oracle中函数的使用实例
- Execl中vlookup函数的使用实例
- java中Math函数的使用实例
- 1085. Perfect Sequence (25)
- 宏定义交换两个变量值的陷阱
- App外包流程,2017最新
- Spring MVC 参考文档
- MySQL学习(二)DQL 加强,多表查询
- 简述unity中Instantiate实例化函数的使用
- C++智能指针shared_ptr剖析
- 用数组去实现队列(c)
- linux下notify机制(仅用于内核模块之间的通信)
- 我的第一篇博客
- C++第2次实验(基础班)—简单程序设计
- 在软件开发生命周期中使用应用程序验证器
- 正则表达式第一天
- 实现一个功能完整的增、删、查、改表格控件