Problem after I reset the player, but not the game

Hey. I am having a major problem that I think is a glitch with Unity. I put this code down in order to reset the player back to a certain point in case the player ever got stuck inside of a collider. This is the code I have. (It is in C#)

using UnityEngine;
using System.Collections;

public class ResetPlayer : MonoBehaviour {
private Transform RespawnPlayer;
private GameObject Player;
// Use this for initialization
void Start () {

RespawnPlayer = GameObject.Find(“ResetPoint”).GetComponent();
Player = GameObject.Find(“CharacterRobotBoy”);
}

public void ResetButtonForPlayer()
{
Player.transform.position = RespawnPlayer.position;

}

}

The problem I am having is every time after I push the button the first time, pushing the space button then activates this code again. I cannot figure out why it would, since I did not tell it to in any way. Please help me find a way to get around this by adding in more code or by editing my code. This whole problem just baffles me.

Hello! I just checked out the problem. Unity buttons by default allow keyboard navigation. If you only want it to be a clickable button with no keyboard controls, choose None here.

1 Like