How to call Method from same Script on different Objects?

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: