How to get the gameObject from custom ShaderGUI?

I am writing my custom ShaderGUI, what I want is when I enable some toggle on my ShaderGUI, I check and create a script on that gameObject that passes down some parameters that my shader needs, and when I disable that toggle I delete that script.

So how can I get that gameObject in my custom ShaderGUi script?

Selection.activeObject? Or Selection.gameObjects?

Please look at the dates of posts before replying. This post was made over a year ago and the dev hasn’t posted since.