2
如何在Unity代碼中創建動態對象(多維數據集)從一面牆到另一面牆?這樣的位置: Unity創建動態對象
如何在Unity代碼中創建動態對象(多維數據集)從一面牆到另一面牆?這樣的位置: Unity創建動態對象
這很有趣,團結傢伙已經寫它看起來像正是你正在努力實現:)
您可以實例化一個預製與2句同樣的事情爲例。
public GameObject objToCreate;
void Start()
{
//2 for sentences to create a vidirectional array
for(int i = 0; i<5;i++){ //for move on Y
for(int j = 0; j<5;j++){ //for move on X
Instantiate(objToCreate, transform.position,transform.rotation);
transform.Translate(1f,0,0); //Move on X
}
transform.Translate(0,1f,0); //When fill X translate on Y and start again
transform.Translate(-5f,0,0); //Reset out transform position 5 units as set in the first for sentence
//For mor space between objects just change the values in Translate function
}
}
非常感謝你:)你知道我該如何在立方體之間創建空的空間嗎? –