贡献者:赵大财
博客:https://my.oschina.net/zhaodacai GitHub:https://github.com/dacaizhao
邮箱: dacai_zhao@163.com QQ:327532817
=============================
终于可以上代码了 悸动的心 颤抖的手 一起玩玩吧
using UnityEngine;
using System.Collections;
public class dacai : MonoBehaviour
{
public GameObject housePrefeb; //这个需要关联和ios里面拖控件等价
void Start ()
{
for (int row = 0; row < 2; row++) {
for (int col = 0; col < 5; col++) {
GameObject cube = GameObject.CreatePrimitive (PrimitiveType.Cube); //创建立方体
cube.transform.position = new Vector3 (-5 + col, -2 + row, 0); //位置
cube.transform.Rotate (new Vector3 (0, 0, 0)); //旋转
//cube.transform.localScale = new Vector3 (2, 2, 2);//缩放的 也和iOS差不多
print (-5 + col);
print (-5 + row);
}
}
for (int i = 0; i < 10; i++) {
GameObject dacai = (GameObject)GameObject.Instantiate (housePrefeb);
dacai.transform.position = new Vector3 (5 + i, 1, 1);
dacai.transform.eulerAngles = new Vector3 (0, i * 10, 1);
}
}
}