but this only took effect after the script is attached and in many cases I have seen it first display the default outline then change to the desire output. Is there a way to attach the script with the field already defined?
Thanks in advance
You can’t do that. Component can’t exist without GameObject (sadly).
There is no reason to make configuration in script. You can added component in editor, set all settings and enable in Start if you want. You can also use prefab with script and predefined settings and instantiate it.
You have to use AddComponent to create an instance of the script.
I’m guessing Outline is Unity’s outline component?
My suggestion is to add Outline as a component to the gameobject in the editor and just disable it. Then, instead of using AddComponent, just use GetComponent to grab the component, set it up and then enable it.