Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bug / Crash  Baking a rope is causing unity crashes (unity 6.0.29f)
#1
I'm either doing something completely wrong, or else running into a editor-crashing bug.

Let me start by stating my goal in case I'm completely barking up the wrong tree.  What I want is to have an ObiRope swing for a few seconds, then freeze it into place and then use it as just a standard mesh from that point on.  The way I'm trying to solve this is code like this:

Code:
    public void BakeRope()
    {
        if (ToBake.actor.isLoaded)
        {
            var system = ToBake.actor.solver.GetRenderSystem<ObiRopeExtrudedRenderer>() as ObiExtrudedRopeRenderSystem;

            if (system != null)
            {
                var mesh = new Mesh();
                system.BakeMesh(ToBake, ref mesh, true);
                Rope.enabled = false;
                ToBake.enabled = false;
                Filter.sharedMesh = mesh;
            }
        }
    }

This *sometimes* works.  But it often simply crashes the editor (and a similar crash in a full build).

The relevant part of the crash output looks like this:
Code:
0x00000243F7763DAB (Mono JIT Code) UnityEngine.Mesh:SetSubMesh (int,UnityEngine.Rendering.SubMeshDescriptor,UnityEngine.Rendering.MeshUpdateFlags)
0x0000024250625E13 (Mono JIT Code) Obi.ProceduralRenderBatch`1<Obi.ProceduralRopeVertex>:BakeMesh (int,int,int,int,UnityEngine.Matrix4x4,UnityEngine.Mesh&,bool)
0x00000242506252AB (Mono JIT Code) Obi.ObiExtrudedRopeRenderSystem:BakeMesh (Obi.ObiRopeExtrudedRenderer,UnityEngine.Mesh&,bool)


My question is basically, is this a bug or is there some more proper way to lock a rope's mesh into place and stop the obrirope calculations on demand?
Reply


Messages In This Thread
Baking a rope is causing unity crashes (unity 6.0.29f) - by gnovos - 01-12-2024, 11:31 AM