GameObject tempObject = Instantiate(Resources.Load(attributes.modelName)) as GameObject;
// Set name of the model and the tag
tempObject.name = “playerShipModel”;
tempObject.tag = “player”;
// Doesn't work. Ship does not move?
//tempObject.transform.rigidbody.position = new Vector3(50.0f,0f,0f);
// Issue is the model wont set to the right area and what not. gotta figure out why.
GameObject model = GameObject.Find("playerShipModel");
//model.name = "playerShipModel";
//model.collider.
model.transform.localEulerAngles = new Vector3(0,0,0); //attributes.initialRotation;
model.transform.localScale = attributes.initialScale;
model.transform.position = new Vector3(0,0,1.0f);
// Trying with transform before and after still doesn't work.
//model.transform.parent = this.transform;
//model.transform.position = new Vector3(0,0,0);
That is my code. I’ve tried to move the ship via temporary and find before and after I set the transform. The ship wont move at all unless I go directly in and pause the game then move it my self. I don’t know why.
Update – This is weird. I can move it, but I cannot set it’s position. I have to add or subtract from it’s position.
Update 2 – Solved. Read answer below.