![]() |
Bug / Crash Manual fluid emission throw exception with Compute backend - Printable Version +- Obi Official Forum (https://obi.virtualmethodstudio.com/forum) +-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html) +--- Forum: Obi Fluid (https://obi.virtualmethodstudio.com/forum/forum-3.html) +--- Thread: Bug / Crash Manual fluid emission throw exception with Compute backend (/thread-4095.html) |
Manual fluid emission throw exception with Compute backend - turkugamelabdev - 25-01-2024 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: Code: ArgumentNullException: Value cannot be null. This does not happen on Burst backend. Here is simple code to replicate the error: Code: public class EmitManually : MonoBehaviour RE: Manual fluid emission throw exception with Compute backend - josemendez - 02-02-2024 Hi there, The compute backend requires adding/destroying particles at a specific point in the solver's update cycle, can't be emitted at any time. EmitParticle() and KillParticle() can only be called in the solver's OnSimulate event. This is because data on the CPU is sent to the GPU only once per frame, so modifying data on the CPU after it's been send to the GPU will result in both getting out of sync. This isn't documented yet, so we'll make sure to mention it in the manual in the relevant places. We'll also look into adding a proper error message when attempting to do this. thanks for reporting the issue! |