Bug / Crash Null error in particle attachment in standalone build - Printable Version +- Obi Official Forum (https://obi.virtualmethodstudio.com/forum) +-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html) +--- Forum: Obi Rope (https://obi.virtualmethodstudio.com/forum/forum-4.html) +--- Thread: Bug / Crash Null error in particle attachment in standalone build (/thread-2516.html) |
Null error in particle attachment in standalone build - mr-matt - 29-09-2020 I'm attaching an ObiParticleAttachment to my ropes at runtime by AddComponent and I then set the target (among other things). In the editor this works fine but in a standalone build I get this error: Code: NullReferenceException: Object reference not set to an instance of an object I'm using the latest Obi version, Unity 2019.4.10f1, and HDRP 7.4.3. RE: Null error in particle attachment in standalone build - mr-matt - 30-09-2020 I can now reproduce this error in the editor. If I comment out the OnValidate() function in ObiParticleAttachment.cs (not called in build) the same error occurs. RE: Null error in particle attachment in standalone build - josemendez - 30-09-2020 (30-09-2020, 08:43 AM)mr-matt Wrote: I can now reproduce this error in the editor. If I comment out the OnValidate() function in ObiParticleAttachment.cs (not called in build) the same error occurs. Hi there, Could reproduce the issue. Will fix it and provide a patch asap. RE: Null error in particle attachment in standalone build - josemendez - 30-09-2020 False alarm, I was using a different repo branch and the error was not even the same. I'm unable to reproduce it on latest version in the store (5.6). Creating an attachment at runtime works fine both in editor (with or without OnValidate) and standalone. I'm using this code in Update(): Code: if (Input.GetKeyDown(KeyCode.G)) Your error (line 337, in the Disable() method) points to this line: Code: if (actor.isLoaded && isBound) The only thing that can be null here is "actor", which should never be null as the attachment requires an ObiActor component to be present in the game object. Can you post the code you're using to add the attachment? RE: Null error in particle attachment in standalone build - mr-matt - 30-09-2020 Fixed the issue. My rope gameobject was disabled until after the particle attachments were added. Switching the order such that Awake() was called in ObiParticleAttachment before I set the target solved this. |