2 part question. 1. What would be the benefit of having the GameObject.Find("respawn") over just manually assigning the r...

2 part question. 1. What would be the benefit of having the GameObject.Find("respawn") over just manually assigning the respawn in the inspector panel. 2. So instead of doing colliders, I would like to set it up so when I press a button it teleports you to that location. So I've got if (Input.GetKeyup(KeyCode.Space)) { transform.position = spawn.position; { and this is all under a public void. However it does not work but it also doesn't give me an errors. If there were errors then I would be able to troubleshoot.
  • Kyle Shaffer(kyleisdank) replied
    Alright so I got it to work. But it actually made me ask another question. So if I put that code into the update function, then it worked just find. I teleported right there after pressing releasing the button. Why would I need the update function when pressing a button but not when I was doing it with a collider?
  • Jonathan Gonzalez(jgonzalez) replied
    Good questions. If you use OnTriggerEnter or OnCollisionEnter these functions seem to work independently. If you create your own custom function like you did, Unity has no idea when to use that information. So when you use it in the Update function it's continually updating to see if anything has changed. If it detects a button input, then it proceeds to do whatever you had in that specific function. Let me know if you need further clarification.