Hey guys,
This might be pretty simple, but I can’t get it work.
When my game starts, I have a bunch of objects already placed on a table. Then I pick one of the them and I move it somewhere else. However, if I press another button I would like it to go to its original position.
What I’ve done until now is to set a script on each of the object like that:
var originalPosition: Vector3;
function Start() {
originalPosition = transform.position;
}
This works, but only the first time, as when I instantiate the object in a different place, the start position is different.
How would I go about storing the initial value even after instantiate?
That definitely helps! It now doesn't change the position after picking up, but the problem is that I have multiple objects in the scene with the same script applied to them and it only stores the value of 1 object, which is the last one interpreted. It's a bit wierd...
– dai4Nevermind, solved it. I just had to remove static from the variable declaration. Thanks a lot Landern!
– dai4