Hi, so i am creating an endless runner game and i want one of my game objects to fall from the top of the screen after a set time. I have a code for the falling and one for the delay but together they don’t seem to work. Any suggestions would be highly appreciated.
public class Fall : MonoBehaviour
{
public float fallSpeed = 4.0f; //how fast the object fall
[SerializeField]
GameObject _pigeon;
// delays the method defined in the code
void Start()
{
Invoke("DisplayPigeon", 2);
}
//unhides the pigeon gameobject
public void DisplayPigeon()
{
_pigeon.SetActive(true);
}
//should move the pigeon down the screen
void Update()
{
transform.Translate(Vector3.down * fallSpeed * Time.deltaTime, Space.World);
}
}