How do I reference a generic script in another script?
So lets say Object AO has script AS with method name "Method()".
Another object BO has a script BS with the same name "Method()".
Now, I want to have a script SS which will be attached to both AO and BO and have a reference to AS and BS respectively via the Unity editor. From that SS script I will do a logic which will use "Method()" name.
The problem here is that I want to do in SS script:
public GameObject ao_or_bo_script;
ao_or_bo_script.Method();
but that will work only if I'll do a type cast like
(AO)ao_or_bo_script.Method();
or
(BO)ao_or_bo_script.Method();
which doens't work for me because I don't know wich script I'll attach
↧