Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  3. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Bug Removing or forgetting to add MeshBounds causes crash with unhelpful exception (0.32)

Discussion in 'Project Tiny' started by Sarkahn, Feb 9, 2021.

  1. Sarkahn

    Sarkahn

    Joined:
    Jan 9, 2013
    Posts:
    440
    Hello, as the title says, if you try to create a renderable entity without MeshBounds or remove the MeshBounds from an existing entity, it will cause a crash with the exception shown below. It's easy to re-create - just make a scene with a cube and remove the MeshBounds from it in a system.

    I found this out because I was trying to create a renderable entity with a dynamic mesh, but I forgot to add the MeshBounds. Due to the unhelpful exception it took a while for me to track down my mistake.

    Aside from a better exception for this case, it would be nice if we had some Tiny equivalent to
    RenderMeshUtility.AddComponents
    which was just added in the latest release of hybrid renderer. Manually creating a renderable entity from code involves a lot of steps and it's pretty easy to overlook something.

    Code (CSharp):
    1. FormatException: Index (zero based) must be greater than or equal to zero and less than the size of the argument list.
    2. System.Text.StringBuilder.AppendFormatHelper (System.IFormatProvider provider, System.String format, System.ParamsArray args) (at <9577ac7a62ef43179789031239ba8798>:0)
    3. System.String.FormatHelper (System.IFormatProvider provider, System.String format, System.ParamsArray args) (at <9577ac7a62ef43179789031239ba8798>:0)
    4. System.String.Format (System.String format, System.Object[] args) (at <9577ac7a62ef43179789031239ba8798>:0)
    5. UnityEngine.DebugLogHandler.LogFormat (UnityEngine.LogType logType, UnityEngine.LogOption logOptions, UnityEngine.Object context, System.String format, System.Object[] args) (at <e414e10bfe5f45729ff122f3359de21b>:0)
    6. UnityEngine.Debug.LogFormat (UnityEngine.LogType logType, UnityEngine.LogOption logOptions, UnityEngine.Object context, System.String format, System.Object[] args) (at <e414e10bfe5f45729ff122f3359de21b>:0)
    7. Unity.Build.Desktop.DotsRuntime.DesktopRun.WaitForProcess (System.Diagnostics.Process process) (at Library/PackageCache/com.unity.platforms.desktop@0.10.0-preview.10/Editor/Unity.Build.Desktop.DotsRuntime/DesktopBuildTarget.cs:31)
    8. Unity.Build.Desktop.DotsRuntime.DesktopRun+<>c__DisplayClass3_0.<RunOnThread>b__1 () (at Library/PackageCache/com.unity.platforms.desktop@0.10.0-preview.10/Editor/Unity.Build.Desktop.DotsRuntime/DesktopBuildTarget.cs:70)
    9. System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) (at <9577ac7a62ef43179789031239ba8798>:0)
    10. System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) (at <9577ac7a62ef43179789031239ba8798>:0)
    11. System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) (at <9577ac7a62ef43179789031239ba8798>:0)
    12. System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) (at <9577ac7a62ef43179789031239ba8798>:0)
    13. System.Threading.ThreadHelper.ThreadStart () (at <9577ac7a62ef43179789031239ba8798>:0)
    14. UnityEngine.<>c:<RegisterUECatcher>b__0_0(Object, UnhandledExceptionEventArgs)