c# - Create empty object with transform information in Unity3D -
my initial intention create transform objects in array, because need points in space, hold information position , rotation. discovered wasn't possible, went create array of empty gameobjects
:
public gameobject[] centers;
from these hoped need. this:
centers = new gameobject[length]; gameobject prevcenter = myheadlink; // myheadlink unrelevant gamobject for(int = 0; < length; i++){ debug.log(centers[i]); centers[i].transform.position = prevcenter.transform.position - prevcenter.transform.forward * prevcenter.transform.localscale.z * 1.5f; prevcenter = centers[i]; }
unfortunately, that's not possible either, because center[i]
null. new gameobject
not create empty gameobject
transform information?
try write:
for (int = 0; < length; ++i) centers[i] = new gameobject();
after:
centers = new gameobject[length];
Comments
Post a Comment