Hey!
I am currently working on a game, where you are controlling a ball on some grounds n stuff.
When you fall down, you have to respawn. And I tried following script but it doesn’t work:
#pragma strict
var maxFall = -10;
function Update ()
{
if (GetComponent.().position.y <= maxFall)
{
Debug.Log(“Test”);
}
This is a fairly unhelpful statement. What does it do? Does it not trigger? Did you actually attach it to the gameobject that is falling? Did you put a Start() function in there that tells you that it was even instantiated? Did you try setting a breakpoint at the start of Update()? Is your function even running anywhere? These are things you should be able to instantly ascertain in any and every case of scripting and there are plenty of tutorials to guide you there.