Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Adding ObiEmmitor gameObject in code
#10
(31-03-2018, 09:20 AM)Caldor Wrote: I think I found your problem, because my problem was pretty much the same. When you start the Unity project and the emitter with the particle renderer is disabled, the camera with the fluid renderer does not seem to be able to find it when it is enabled again.

I guess I will have to look into the code a bit to figure out what might cause this. I am guessing taking a part of its awake script and make it something it checks now and then could help fix this, making it possible to instantiate emitters at runtime.


I found my problem. My emitter was inactive / deactivated when the Unity project started and got enabled as I fired the gun. Which I guess the fluid renderer does not like. I still have one mystery though... whenever I activate the gun, by changing its emitter from 0 to 3 now, it still causes the faucet emitter to also emit particles. Any idea what might cause that?

I have made the emitter transform and its Obi Emitter script public so that I can ensure that the gun targets the two directly. I used a gameobject.find before, but even then it only found one, the one it was supposed to. Now I dont use that, and it still emits from both the faucet and the gun.

Also it would be nice to know if there is a way to use two different fluid materials at the same time? Right now the camera seems to decide which material the fluid has, rather than the emitters and the particle renderes on them.


Hi there.

If you're using <3.4, you need to call fluidRenderer.SetupFluidRenderingCommandBuffer() after adding new particle renderers to the fluid renderer. In 3.4 this is not necessary (when having AutoUpdate enabled in the fluid renderer).

Regarding the faucet and the gun emitting at the same time, make sure the emitter shapes reference the appropriate emitters. You might have both shapes referencing the same emitter.

To use two )or more) different fluid materials at the same time, add two FluidRenderers to the same camera, each one referencing the appropriate particle renderer. Then give each one its own fluid material.

cheers,
Reply


Messages In This Thread
RE: Adding ObiEmmitor gameObject in code - by josemendez - 31-03-2018, 01:43 PM