decline-cookies / anvil-unity-dots

Unity DOTS and ECS specific additions and extensions to Anvil
MIT License
4 stars 1 forks source link

Post Entities 1.0 - Fixing the Systems Debug Window #297

Closed jkeon closed 8 months ago

jkeon commented 8 months ago

Due to our work in having top level System Groups alongside the built in Initialization, Simulation, and Presentation groups, Unity's System Window for debugging in the Editor breaks.

InvalidProgramException: Couldn't find system "YOUR CUSTOM SYSTEM" in World
Unity.Entities.Editor.WorldProxy.FindSystemIndexFor (Unity.Entities.ComponentSystemBase sys) (at ./Library/PackageCache/com.unity.entities@1.0.11/Unity.Entities.Editor/SystemSchedule/PlayerLoop/WorldProxy.cs:107)

This is a hold over from Entities 0.51 which had the same issue: https://forum.unity.com/threads/entities-0-50-systems-window-doesnt-handle-custom-top-level-componentsystemgroup.1271861/

Unity still hasn't fixed it.

Solutions

Modified Package

There is a workaround in the forum post that involves modifying the internal source of the package and using that. We would just need to figure out the workflow for using that package instead of Unity's package system one.

This is definitely the easiest code change to make though as written in the forum post.

Injection

Using reflection and some utilities mentioned here: https://stackoverflow.com/questions/7299097/dynamically-replace-the-contents-of-a-c-sharp-method

And then here: https://github.com/spinico/MethodRedirect

We could keep the Unity package as is, but then write a custom method that works properly and inject that method into the class to replace the method that currently uses the local hardcoded array.

This is a much nicer solution but might be a bit tricky to pull off.

mbaker3 commented 8 months ago

Duplicate of #24 Updated task description with modern info and copied solutions described in this task.