A
A
Artyomkar2020-10-12 22:25:33
Unity
Artyomkar, 2020-10-12 22:25:33

How to check the presence of an object on the stage and, in its absence, not execute an event (or just a line of code)?

public void Start()
 {
        GameEvents.current.onLaserTriggerEnter += Lose;
 }

Here is the line, although I think it doesn't matter what the code is... I
guess that you can find the "laser" object using FindObjectWithTag and reset the line using return, but here's how to do it all without a clue ..

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
GavriKos, 2020-10-12
@Artyomkar

If the object is not found - then FindObjectWithTag will return null - check for it

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question