I’d like to know what the best solution for this issue.
Basically I want to instance some prefabs from a script.
The prefab has a script attached which allow to specify the color used by the shader (for example)
When I use The instance function I can specify the position / orientation
But I haven’t find a way to specify this color variable for the script used by the prefab ?
Any idea ?
Looks like it could work using some static variable but I’m sure there a more elegant solution
Thanks in advance
oX
function FireRocket () {
var rocketClone : Rigidbody = Instantiate(rocket, transform.position, transform.rotation);
rocketClone.velocity = transform.forward * speed;
// You can also acccess other components / scripts of the clone
rocketClone.GetComponent(MyRocketScript).DoSomething();
}