I’ve read a few posts but all the spawns were activated by death or completion of a level. Can anyone help me for adding a spawn that I can bind a key e.g. F1 to reset the player to the staring point?
Thankyou in advance!
I’ve read a few posts but all the spawns were activated by death or completion of a level. Can anyone help me for adding a spawn that I can bind a key e.g. F1 to reset the player to the staring point?
Thankyou in advance!
Take the spawn code from an example and then look in the reference guide for Input.GetKeyDown.
Spawning is Instantiating, which you can also find in the ref guide
Could you link what you’re talking about so we get a better understanding of what you are talking about.
public GameObject player; //player prefab goes here
void Update()
{
if (Input.GetKeyDown(keycode.f1))
{
print("F1 was pressed");
SpawnObject();
}
}
void SpawnObject()
{
// do code to kill and respawn the player
Destroy(player);
Instantiate(player, new Vector3(0, 0, 0), Quaternion.identity);
}