Code (csharp): var inventory : Texture2D; var item : Transform; var weaponbone : Transform; function OnGUI () { GUI.BeginGroup (Rect (1150, 550, 300, 50)); GUI.Box (Rect (0,0,200,50), ""); if (GUI.Button (Rect (0,0,200,50), "Click")){ //instantiating equiped item var weap = Instantiate(item, GameObject.Find("WeaponEquip").transform.position, Quaternion.identity); } GUI.EndGroup (); } im trying to instantiate the weapon prefab at the same coordinates, which is working, but it is always facing the z axis. i want it to instantiate the weapon looking at the same axis and rotation as the weaponbone var. how am i to do this? or maybe i can do Code (csharp): weaponbone = item; why is this not working?
You are setting it's rotation to Quaternion.identity. If you want it to be facing the same way, you need to put in Code (csharp): weaponbone.rotation Instead.