Proper rotation when instantiating an object

I am having a tough time with this and hoping someone can give me a hand. When I equip a weapon, I am Instantiating the weapon from a prefab, and parenting it to an empty gameobject. The problem is that it is never rotated correctly. What I am doing is this, I set it up weapon prefab (say a sword). I pull a character into the scene, then move the weapon where I want it to position it on my character, then child it to the weapon mount. Save the weapon prefab, then run my game, equip the item.

How can I ensure that the weapons are always facing the right direction, and are rotated correctly so when I instantiate them, it works correctly. What am I missing here??

            if (Core._playerCharacter.GetEquipedItem(equipRegion) == null)
            {
                InventorySystem.RemoveItem(item);
                Core._playerCharacter.EquipItem(item);

                equipIcons[pos] = item.InventoryIcon;
                CharacterAsset chrAsset=(CharacterAsset)Core._playerCharacter.CharacterModel.GetComponent("CharacterAsset");             	
                foreach(GameObject go in chrAsset.equipRegion){
                    if(go.name == equipRegion.ToString()){
						foreach (GameObject obj in chrAsset.equipment)
                        {	
                            if (item.Name == obj.name)
                            {
								//temp = the mesh we are loading
	                        	temp  = (GameObject)Instantiate(obj);
                              	temp.transform.position = go.transform.position;//new Vector3(0, 0, 0);                              
							  	//temp.transform.rotation = go.transform.rotation;
							  	//temp.transform.localPosition = new Vector3(0, 0, 0);        
								temp.transform.localRotation = new Quaternion(0,0,0,0);//.Euler(0, 0, 0);	
                              	temp.transform.parent = go.transform;																  	
								_gameObject.Add(pos, temp);
								item.Equipped = true;
                            }
                        }
                    }
                }
            }

you’re tying the sword to an empty gameobject, and explicitly zeroing the rotation of the sword to it’s parent?.. have you checked the rotation of the empty gameobject?

where is the mesh coming from? I know blender imports have a joyful “feature” where by all meshes are brought in at 90deg to what you’d expect… only work around I’ve found to that is to rotate and save the blender file then pull it in…

I have also tried, as you can see above setting it to the rotation of the empty game object, that has not worked either. I only have these things as FBX. I purchased them from the asset store. Can I use blender to modify the rotation of an FBX? Forgive the ignorant question, I am a coder and usually purchase or have someone else do the graphics assets. Thanks

HC

the issue is with .blend files coming directly out of blender (something to do with xyz axis being different in unity/blender) FBX files should be fine as i understand it…