Obi Official Forum

Full Version: Scripting color changes
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I would like a script that changes the color of an Obi fluid emitter. Sorry for the newby question, I'm new...
(13-07-2023, 05:47 PM)glipkowitz Wrote: [ -> ]I would like a script that changes the color of an Obi fluid emitter. Sorry for the newby question, I'm new...

Hi there,

I'd recommend learning C# before moving on to more advanced subjects like fluid simulation, otherwise you'll get stuck at quite literally every step of the way.

Particle color is a public property of the ObiParticleRenderer component, so you can set it like you would normally in Unity: get a reference to the component, and set the property:

Code:
public class ChangeColor : MonoBehaviour
{

   public ObiEmitter emitter;

   public void Awake()
   {
      emitter.GetComponent<ObiParticleRenderer>().particleColor = new Color (1,0,0,1);
   }
}

kind regards,