【发布时间】:2017-05-15 20:26:36
【问题描述】:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Test : MonoBehaviour {
public float spinSpeed = 2.0f;
public int cloneTests;
public GameObject prefab;
private bool rotate = false;
private bool exited = false;
private void Start()
{
for (int i = 0; i < cloneTests; i++)
{
GameObject Test = Instantiate(prefab);
Test.tag = "Testing";
}
}
}
克隆正在运行。
但它不会将标签添加到每个游戏对象。 我怎样才能把所有的克隆作为孩子放在另一个 GameObject 下?
【问题讨论】:
-
这就是你让他们成为孩子的方式:Test.transform.parent = this.transform;它正在工作。但是向每个标签添加新标签是行不通的。所有 lcones 都未标记。