Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Scripting color changes
#1
I would like a script that changes the color of an Obi fluid emitter. Sorry for the newby question, I'm new...
Reply
#2
(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,
Reply