r/Unity3D•
Tobias36636

Creating a referencing to a script

Noob Question :snoo:

Is it possible to create a reference to a script like you can do with a gameObject. For example

ReferencedScript script = gameObject.GetComponent<ScriptName>();

Or do I have to use GetComponent<>() every time I want to reference the script?

Thanks for every answer

Posted May 8, 2022, 10:01 AM UTC

25
Loading comments…