I’m trying to set up a basic respawn script. I need the player to return to the spawn point after hitting an object. The problem is, it’s been a long time since I had to deal with spawning codes so I’m kind of just flailing around trying to get something to work.
private Transform respawnPosition;
void Start()
{
respawnPosition.position = GameObject.FindWithTag ("Spawn");
}
void OnTriggerEnter (Collider other)
{
if (other.gameObject.tag == "Top")
{
this.rigidbody.isKinematic = true;
falling = false;
}
if (other.gameObject.tag == "Platform")
{
transform.position = respawnPosition.position;
}
}
The main errors I’m getting is obviously that I cannot implicitly convert type Transform to GameObject and I cannot implicitly convert type GameObject to Vector3. (The current error for the code I provided is the Cannot implicitly covert type GameObject to Vector3).
I know it’s going to be incredibly simple, I look at this and I KNOW it’s simple, but for some reason I can’t seem to figure it out.
EDIT: The kinematic and falling stuff is not important to this problem I don’t believe, I simply copied the entire OnTriggerEnter code from my script.