It's simple c# question, that make me spent minutes without good result.
How to merge this
GameObject mesh01 = Resources.Load("mesh_01") as GameObject;
Instantiate (mesh01, new Vector3(0, 0, 0), Quaternion.identity);
into single. Since it produce a clone of the mesh01 and not the mesh01 itself.
Thanks in advance!
1 Answer
1
Are you trying to do this?
GameObject mesh01 = (GameObject)Instantiate(Resources.Load("mesh_01", typeof(GameObject)));
There is a great deal of info to be found browsing around the Script Reference page for functions which are giving you hassles, or you'd just like to learn more about.
http://unity3d.com/support/documentation/ScriptReference/index.html
You'll find often you may find your answer quicker with a simple browse through there.
I got this: error CS0266: Cannot implicitly convert type
– anon71183063UnityEngine.Object' toUnityEngine.GameObject'. An explicit conversion exists (are you missing a cast?) What I'm trying to do is to load a mesh (mesh01) from Resource then placed on Vector3(0, 0, 0).Sorry, I forgot to put the cast in. Done.
– anon45606706Feel free to put your Position and Rotation inside the Instatiate function as you had it.
– anon45606706Is this always put my mesh01 into Vector3(0, 0, 0)? Or I do need some extra code?
– anon71183063Ok, KeithK... You the MAN. About Position and Rotation solved.
– anon71183063