L
L
LittleBob2021-11-09 18:47:49
Unity
LittleBob, 2021-11-09 18:47:49

How to disable a GameObject script through another script?

It is clear (probably) that you need to make a reference to the object, but enabled does not accept GameObject, and SetActive disables only the object itself, the script remains working. What is the way out?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
U
Uncle Bogdan, 2021-11-09
@LittleBob

If you mean to disable the script from another object, then:

обьект.GetComponent<Название скрипта>().enable = false;

Or you can directly:
НазваниеПоля.enable = false;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question