25-01-2024, 12:37 PM
Hi,
I received the latest ObiFluid 7 beta on 24/1/2024. I want to manually emit particle by setting emitter.speed = 0 and then call emitter.EmitParticle() instead. However, the emitter.EmitParticle() on Compute backend caused this exception:
This does not happen on Burst backend.
Here is simple code to replicate the error:
I received the latest ObiFluid 7 beta on 24/1/2024. I want to manually emit particle by setting emitter.speed = 0 and then call emitter.EmitParticle() instead. However, the emitter.EmitParticle() on Compute backend caused this exception:
Code:
ArgumentNullException: Value cannot be null.
Parameter name: buffer
UnityEngine.ComputeShader.SetBuffer (System.Int32 kernelIndex, System.Int32 nameID, UnityEngine.GraphicsBuffer buffer) (at <f7237cf7abef49bfbb552d7eb076e422>:0)
UnityEngine.ComputeShader.SetBuffer (System.Int32 kernelIndex, System.String name, UnityEngine.GraphicsBuffer buffer) (at <f7237cf7abef49bfbb552d7eb076e422>:0)
Obi.ComputeFluidMesherSystem.Render () (at Assets/Obi/Scripts/Common/Backends/Compute/Rendering/Fluid/ComputeFluidMesherSystem.cs:406)
Obi.ObiRenderSystemStack.Render () (at Assets/Obi/Scripts/Common/Solver/ObiRenderSystemStack.cs:41)
Obi.ObiSolver.Render (System.Single unsimulatedTime) (at Assets/Obi/Scripts/Common/Solver/ObiSolver.cs:1527)
Obi.ObiSolver.LateUpdate () (at Assets/Obi/Scripts/Common/Solver/ObiSolver.cs:970)
This does not happen on Burst backend.
Here is simple code to replicate the error:
Code:
public class EmitManually : MonoBehaviour
{
[SerializeField] private ObiEmitter emitter;
[Range(1, 100)]
[SerializeField] private uint particlesPerEmission = 1;
private void Awake()
{
emitter.speed = 0;
emitter.minPoolSize = 0;
}
private void Update()
{
if (Input.GetKeyDown(KeyCode.Space))
{
for (uint i = 0; i < particlesPerEmission; i++)
emitter.EmitParticle(0);
}
}
}