Hi, I am trying to make a stealth game. so I use Monitors to find Player and then Monitors tell the Guards to chase the Player. I use FindGameObjectWithTag in Guard Script to use the Bool in Monitor Script. everything is fine if I only have one Monitor and one Guard. But, if I have two or more Monitor, the Guard would ignore some Monitors…So, How to let Guards know from any Monitors? Thank you !
Hi,
To be able to call an “external” method from different objects, you need a reference to the other object which contains the method you would like to call. There are multiple ways to reference something in the Unity scene: for example, by calling one of the Find methods, or by assigning a reference manually. I don’t know in which course and lecture you are but the [SerializeField] attribute could be interesting for you.
Also please feel free to ask our helpful community of students for further advice over on our Discord chat server.
See also:
- Forum User Guides : How to mark a topic as solved
1 Like
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.