Question by
UnexpectingError · Mar 14, 2016 at 03:15 AM ·
instantiategetcomponent
questions about instantiate copies
Hi, recently I want to make copies of a game object itself on its own code. like this:
using UnityEngine; using System.Collections; public class clone: MonoBehaviour { public GameObject a ; void Start() { for (int i = 0; i < 10; i++) { Instantiate(a , new Vector3(i * 2.0F, 0, 0), Quaternion.identity); a.GetComponent.enabled = false; } } } I try to assign 'a' as the game object that contains this clone script, and I know it will cause error because it will copy the scripts, too, therefore I made the last line to disable the scripts of the new copy, but the compiler said there is something wrong with the last line, it said"expression demotes a 'method group' where a 'variable', 'type', or 'value' was expected." Pls Help me!
Comment