Quantcast
Channel: Answers for "GameObject.Find("In-Game-Object") Position"
Viewing all articles
Browse latest Browse all 4

Answer by Adrian Love

$
0
0

Okay, So what objects are in your hierarchy?

I read your code like this:

When this object is loaded look for (Game)Objects 1 through 5 and save their positions into Vector3 objects labeled "Object_1" through "Object_5".

If you'd like to access the transform try something like this:

GameObject.Find("Object_1").transform.position;

Read more about selectors here: http://unity3d.com/support/documentation/ScriptReference/GameObject.Find.html

Each GameObject has a Transform component automatically: http://unity3d.com/support/documentation/ScriptReference/Transform.html

Also, you might want to try and use tags if you find yourself accessing a lot of the same type of object. read more about them here: http://unity3d.com/support/documentation/Components/Tags.html

Good luck with whatever you're doing. If you want more specific information try expressing what the overall goal is next time. :)


Viewing all articles
Browse latest Browse all 4

Trending Articles



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