Quantcast
Channel: Questions in topic: "attach"
Viewing all articles
Browse latest Browse all 168

scripts as a addcomponent to a gameobject

$
0
0
Hi, I've read the reference to AddComponent but its not making sense and when using the mono editor, its still not making sense. here's where i am stuck at: Apple A=new Apple; A.setName("Green Apple"); GameObject Bob=(GameObject) Instantiate(Resources.Load("Bob"),Vector3.zero,Quaternion.identity); how do I attach 'A' to Bob? would: Bob.AddComponent() <-- wouldnt this just attach a new script component to bob and not the one create 'A' above? Bob.AddComponent("Apple") <--- isnt this the same as above , adding a new component of script Apple to Bob. i m trying to figure out how to attach the already create 'A' to Bob. Thanks

Viewing all articles
Browse latest Browse all 168

Trending Articles