- Home /
Question About Clone
I heard about some technique which uses for particular system is clone. I can clone object but I cannot call specific function in clone object.
GameObject gObj;
GameObject[] list = new GameObject[5];
ScriptCode[] scr = new ScriptCode[5];
// Use this for initialization void Start () {
gObj = GameObject.Find("GameObject_in_scene");
for (int i = 0; i < 5; i++)
{
list[i] = Instantiate(gObj, new Vector3(0 + (10 * i), 0, -2), Quaternion.identity) as GameObject;
scr[i] = list[i].GetComponent<ScriptCode>();
scr[i].SetSomeSpecificAttributes(2*i,3*i);
}
}
I had debugged and found that SetSomeSpecificAttributes(...) function was called but I don't understand why my clone objects has no changes after setting the new attributes.
One more question, This clone system will make the program too much heavy??
Thanks for your any help in advance.(I am new to Unity, Please kindly to explain in simple way)
Comment
Your answer