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

Attaching script to object during runtime doesn't work. New to unity3d. What am I doing wrong?

$
0
0
Hi! I looked in the forums as well, and all they really say is use the GameObject.AddComponent API, but well, that doesn't seem to work. Here's my code (C#): GameObject someGameObject = (GameObject)Instantiate(somePrefab, position, rotation); BlueColour script = someGameObject.AddComponent(); I run the scene, and nada, the script does not execute. I tried `script.enabled = true;` too and nothing. Help? :) Please... Thank you!

Viewing all articles
Browse latest Browse all 168

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>