hello!
I am using my own class(“selectableunitcomponent”),and in another script,I wan to use setactive function(of gameobject),but I did not know how to implement,inherit or to use the set active function on this class.
I will be very grateful if you guys have a solution!
use singleton design pattern, declare a static shared variable on your selectableunitcomponent and access it via other scripts.
Well, if you have a reference to your custom class instance of one of your units, you can simply access the SetActive method by doing
yourObjectRef.gameObject.SetActive(true);
If that’s not what you wanted to do, you should be more specific about your problem, what things you currently have and what doesn’t work.