Instantiated prefab has a z-axis of 90
Whenever I instantiate my prefab, it gets created with its position on the z-axis at 90. The z-axis of the prefab is saved as -5 so I don't know why this is happening. The object I create it under has a z-axis of -5 as well. Why is this happening? Here is how I instantiate it:
void OnMouseEnter()
{
if(arrowPosition.transform.GetChild(index).childCount == 0)
{
Vector3 position = arrowPosition.transform.GetChild(index).position;
GameObject pointer = Instantiate(arrowPointer, position, Quaternion.identity)
as GameObject;
pointer.transform.SetParent(arrowPosition.transform.GetChild(index), false);
}
}
I set the index from the Unity Editor. Any help would be appreciated as I can't see the prefab unless it's on -5.
Your answer
Follow this Question
Related Questions
Cannot convert UnitEngine.Vector3 to UnityEngine.Transform when using .postition 1 Answer
What is different when Instantiate set Prefab Position? 1 Answer
How to store a position that is moving to create a prefab to spawn at the exact position 1 Answer
Instantiate prefab if no prefab exists at location 1 Answer
Instantiated prefab trying to keep weird Y position 0 Answers