This was working until I updated unity to 2017.3.0f3 now Instantiate just ignores whatever position I enter and only instantiates at the prefabs location. I can put any trivial vector value in the position property and it simply does not change the objects position. If I add the line:
knife.transform.position = firePosition
It puts the object in the correct place. Is this a known issue or did something change in the Instantiate function?
Example code is below
void ThrowKnife(float stickAngle, Vector2 forceVector)
{
Bounds bounds = GetComponent<Collider2D>().bounds;
Vector2 firePosition;
float yPos = bounds.center.y;
if (FacingRight)
{
Debug.Log("Facing Right");
firePosition = new Vector2(bounds.max.x + .1f, yPos);
}
else
{
firePosition = new Vector2(bounds.min.x + .1f, yPos);
}
GameObject knife = Instantiate(Knife, firePosition, new Quaternion(), transform.parent);
knife.transform.eulerAngles = new Vector3(0, 0, stickAngle);
knife.GetComponent<Knife>().ForceAngle = forceVector * ThrowSpeed;
}