Issue with Rope (Chain) in scene - 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: Issue with Rope (Chain) in scene (/thread-337.html) |
Issue with Rope (Chain) in scene - Sbmhome - 03-02-2018 Hi, I created a chain (similar to the example scene). After I saved the scene, it works. After I continue to work on my scene (without making any changes to the chain), I notice that the mesh for chain shows up in the scene view (when its not running ) and I can't select it. Even if I delete the Obi rope from the scene it stays there, until I reboot Unity. This in itself is a bug, however my real issue is that at this point if I bake Occlusion Culling in the scene, the Obi Rope causes the scenes Occlusion Data to be corrupted. This prevents me from opening the scene (it crashes every time), until I manually delete the Occlusion Data for the scene. If i remove Obi rope from the scene, I can then re-bake the Occlusion Culling and I have no more issues. Note: I also have Obi Cloth installed and I have no issues with it. Unity 5.6.3 p4 RE: Issue with Rope (Chain) in scene - josemendez - 03-02-2018 (03-02-2018, 05:05 AM)Sbmhome Wrote: Hi, Hi there, This happens when an object with the hide flag HideAndDontSave is not properly destroyed. The rope mesh is created in ObiRope's Start() and destroyed in ObiRope's OnDestroy(). So rope and mesh should always be created and destroyed together (at least in theory). For some reason the rope was removed from the scene without OnDestroy() being called, possibly the result of Unity crashing or a bug of some sort. We've been unable to reproduce it with ObiRope, but has happened for us in the past with other assets and even with Unity's own components, that's why I recognize the problem. Unity won't let you see this mesh in the hierarchy or select it, because it is marked as HideAndDontSave. It will stay in the scene permanently until you destroy it. The only fix for this is to access all Mesh components that have this hide flag trough an editor script and remove them from the scene by calling DestroyImmediate(). It's just a couple lines of code, but let me know if you need help with it. kind regards, RE: Issue with Rope (Chain) in scene - Sbmhome - 05-02-2018 (03-02-2018, 09:20 PM)josemendez Wrote: Hi there, I could write a script to excute DestroyImmediate() in the Editor, but I want to know how to permanently avoid this issue. A little more on how I'm using it. I have the chain in an area of my map that isn't viewable when the player enters. I'm currently disabling the obi rope gameObject to save resources and then enabling it once the player is close. I never destroy the GameObject. I am using additive scene loading (if that makes a difference). Is there a better way to ensure its using zero resources and to make sure this issue doesn't occur? I'm making a VR game, so I really need it to be zero (CPU & GPU) when not viewed as my budget for everything is very strict. Thanks. RE: Issue with Rope (Chain) in scene - josemendez - 05-02-2018 (05-02-2018, 08:52 PM)Sbmhome Wrote: I could write a script to excute DestroyImmediate() in the Editor, but I want to know how to permanently avoid this issue. Hi, Can you reproduce the issue consistently, or has it only happened once to you? The rope mesh is always destroyed both in play mode and in editor for us, both when enabling/disabling the rope and when creating/destroying it. As I mentioned, the only way I can think of for this to happen is for rope.OnDestroy() to be ignored by Unity for some reason when exiting play mode. To stop all actors in a solver from being updating when not viewed by any camera, untick the "Simulate when invisible" checkbox in ObiSolver. See:http://obi.virtualmethodstudio.com/tutorials/obisolver.html RE: Issue with Rope (Chain) in scene - Sbmhome - 05-02-2018 (05-02-2018, 09:16 PM)josemendez Wrote: Hi, The issue doesn't happened consistently. I may put the rope into the scene and its fine for a few days (I'm working on the same scene at 8-12 hours a day). But then it will start acting up. So as that point I would have to delete the whole thing and re-create the chain and pins. From what you said, I will run a script to just find it and destroy it...and that should clear it up without me having to re-create it ...correct? Note: I currently have "Simulate when inviisble" unticked. I've been disabling it as a precaution...just a bad habit as I've been burned in the past by other assets that consume resources even when they shouldn't. I'll make sure that it doesn't get disabled. Side question: Is it possible to record the physics simulation for obi cloth or rope and save as an animation? I want to having cloth and rope in more places...but need it to be super lightweight for that to happen. Thanks for the timely replies...this has been a big help! |