How do you move one object’s position to another in unity? I need to make my player object move to the spawn point when he dies. Here is the code I am using:
this.transform.position = spawnpointsscript.gameObject.transform.position;
I am having an error with this because I am putting this on a spawn point prefab, because I have multiple levels and want to be able to easily make copies of it. The error says:
An object reference is required to access non-static member `UnityEngine.Component.gameObject’
I am guessing this is because I put it on the prefab instead of the spawn point itself. Is there a way to do this without having to put the script on every individual object, or is that the only way?