Attaching scripts at runtime
Hello! I want to attach a wireframe generator script to all of the objects in an arbitrary scene. We are trying to rapidly iterate on level designs that need some wireframe materials, and it would be great if we can throw a new level into LS without having to set up the wireframe material every time.
I could do this by attaching the scripts at runtime, but I'm not sure how to set the actual script source, after creating the component.
// create the script component, obviously... var wireframeScript = child.createComponent('Script') // now what?
I've wanted to do this in the past, but I ended up using prefabs to accomplish it. That won't work in this case. Here's the old thread, for reference.
I love it when I need to know an answer to something and find myself at the end of the only relevant thread that google can find, lol. Any insights will be appreciated. I'm out of ideas!