├── .gitattributes
├── .github
├── FUNDING.yml
├── ISSUE_TEMPLATE
│ ├── bug_report.yaml
│ ├── config.yml
│ ├── enhancement.yaml
│ └── other.yaml
└── workflows
│ └── dotnet.yml
├── .gitignore
├── CHANGELOG.md
├── ECSExtension
├── BufferView.cs
├── CacheComponent.cs
├── ECSExtension.csproj
├── Extension.cs
├── ExtensionPlugin.cs
├── Inspectors
│ ├── ButtonNativeListHandler.cs
│ ├── ECSComponentCell.cs
│ ├── ECSComponentList.cs
│ └── EntityInspector.cs
├── Panels
│ ├── EntityCell.cs
│ ├── EntityTree.cs
│ ├── QueryComponentCell.cs
│ ├── QueryComponentList.cs
│ └── WorldExplorer.cs
├── Patch
│ └── GameObjectConversionMappingSystem_Patch.cs
└── Widgets
│ └── EntityInfoPanel.cs
├── LICENSE
├── README.md
├── THIRDPARTY_LICENSES.md
├── UnityEditorPackage
├── LICENSE.md
├── README.md
├── Runtime
│ ├── 0Harmony.dll
│ ├── Mono.Cecil.Mdb.dll
│ ├── Mono.Cecil.Pdb.dll
│ ├── Mono.Cecil.Rocks.dll
│ ├── Mono.Cecil.dll
│ ├── MonoMod.RuntimeDetour.dll
│ ├── MonoMod.Utils.dll
│ ├── Tomlet.dll
│ ├── UnityExplorer.STANDALONE.Mono.dll
│ ├── UnityExplorer.prefab
│ ├── UniverseLib.Mono.dll
│ └── mcs.dll
├── Third Party Notices.md
└── package.json
├── build.ps1
├── buildBIE5.ps1
├── buildBIE6.ps1
├── buildCLR.ps1
├── img
├── icon.png
└── preview.png
├── lib
├── ILRepack.exe
├── interop
│ ├── CoreLib.dll
│ ├── ECS
│ │ ├── Unity.Burst.Unsafe.dll
│ │ ├── Unity.Burst.dll
│ │ ├── Unity.Collections.LowLevel.ILSupport.dll
│ │ ├── Unity.Collections.dll
│ │ ├── Unity.Entities.Hybrid.HybridComponents.dll
│ │ ├── Unity.Entities.Hybrid.dll
│ │ ├── Unity.Entities.dll
│ │ ├── Unity.Mathematics.Extensions.dll
│ │ ├── Unity.Mathematics.dll
│ │ ├── Unity.NetCode.Authoring.Hybrid.dll
│ │ ├── Unity.NetCode.Physics.dll
│ │ ├── Unity.NetCode.dll
│ │ ├── Unity.Networking.Transport.dll
│ │ ├── Unity.Physics.Hybrid.dll
│ │ └── Unity.Physics.dll
│ ├── Il2CppSystem.Core.dll
│ ├── Il2Cppmscorlib.dll
│ ├── UnityEngine.AssetBundleModule.dll
│ ├── UnityEngine.AudioModule.dll
│ ├── UnityEngine.CoreModule.dll
│ ├── UnityEngine.IMGUIModule.dll
│ ├── UnityEngine.PhysicsModule.dll
│ ├── UnityEngine.TextRenderingModule.dll
│ ├── UnityEngine.UI.dll
│ ├── UnityEngine.UIModule.dll
│ └── UnityEngine.dll
├── net35
│ ├── BepInEx.Core.dll
│ ├── BepInEx.Unity.Common.dll
│ ├── BepInEx.Unity.Mono.dll
│ ├── BepInEx.Unity.dll
│ ├── BepInEx.dll
│ ├── ECS
│ │ ├── Unity.Burst.Unsafe.dll
│ │ ├── Unity.Burst.dll
│ │ ├── Unity.Collections.LowLevel.ILSupport.dll
│ │ ├── Unity.Collections.dll
│ │ ├── Unity.Entities.Hybrid.HybridComponents.dll
│ │ ├── Unity.Entities.Hybrid.dll
│ │ ├── Unity.Entities.dll
│ │ ├── Unity.Mathematics.Extensions.dll
│ │ ├── Unity.Mathematics.dll
│ │ ├── Unity.NetCode.Authoring.Hybrid.dll
│ │ ├── Unity.NetCode.Physics.dll
│ │ ├── Unity.NetCode.dll
│ │ ├── Unity.Networking.Transport.dll
│ │ ├── Unity.Physics.Hybrid.dll
│ │ └── Unity.Physics.dll
│ ├── MelonLoader.dll
│ ├── UnityEngine.AssetBundleModule_publicized.dll
│ ├── UnityEngine.AudioModule.dll
│ ├── UnityEngine.CoreModule_publicized.dll
│ ├── UnityEngine.IMGUIModule_publicized.dll
│ ├── UnityEngine.PhysicsModule_publicized.dll
│ ├── UnityEngine.TextRenderingModule_publicized.dll
│ ├── UnityEngine.UI.dll
│ ├── UnityEngine.UIModule.dll
│ ├── UnityEngine.dll
│ └── mcs.dll
├── net472
│ ├── BepInEx.Core.dll
│ └── BepInEx.Unity.IL2CPP.dll
├── net6
│ ├── MelonLoader.dll
│ ├── System.Runtime.dll
│ ├── UniverseLib.IL2CPP.Interop.dll
│ └── mcs.dll
└── unhollowed
│ ├── ECS
│ ├── Unity.Burst.Unsafe.dll
│ ├── Unity.Burst.dll
│ ├── Unity.Collections.LowLevel.ILSupport.dll
│ ├── Unity.Collections.dll
│ ├── Unity.Entities.Hybrid.dll
│ ├── Unity.Entities.dll
│ ├── Unity.Jobs.dll
│ ├── Unity.Mathematics.Extensions.dll
│ ├── Unity.Mathematics.dll
│ ├── Unity.NetCode.Authoring.Hybrid.dll
│ ├── Unity.NetCode.Generated.dll
│ ├── Unity.NetCode.Physics.dll
│ ├── Unity.NetCode.dll
│ ├── Unity.Networking.Transport.dll
│ ├── Unity.Physics.Hybrid.dll
│ └── Unity.Physics.dll
│ ├── Il2CppSystem.Core.dll
│ ├── Il2Cppmscorlib.dll
│ ├── UnityEngine.AssetBundleModule.dll
│ ├── UnityEngine.AudioModule.dll
│ ├── UnityEngine.CoreModule.dll
│ ├── UnityEngine.IMGUIModule.dll
│ ├── UnityEngine.PhysicsModule.dll
│ ├── UnityEngine.TextRenderingModule.dll
│ ├── UnityEngine.UI.dll
│ ├── UnityEngine.UIModule.dll
│ └── UnityEngine.dll
└── src
├── CSConsole
├── CSAutoCompleter.cs
├── ConsoleController.cs
├── LexerBuilder.cs
├── Lexers
│ ├── CommentLexer.cs
│ ├── KeywordLexer.cs
│ ├── Lexer.cs
│ ├── NumberLexer.cs
│ ├── StringLexer.cs
│ └── SymbolLexer.cs
├── ScriptEvaluator.cs
└── ScriptInteraction.cs
├── CacheObject
├── CacheConfigEntry.cs
├── CacheConstructor.cs
├── CacheField.cs
├── CacheKeyValuePair.cs
├── CacheListEntry.cs
├── CacheMember.cs
├── CacheMemberFactory.cs
├── CacheMethod.cs
├── CacheObjectBase.cs
├── CacheProperty.cs
├── ICacheObjectController.cs
├── IValues
│ ├── InteractiveColor.cs
│ ├── InteractiveDictionary.cs
│ ├── InteractiveEnum.cs
│ ├── InteractiveList.cs
│ ├── InteractiveString.cs
│ ├── InteractiveValue.cs
│ └── InteractiveValueStruct.cs
└── Views
│ ├── CacheConfigCell.cs
│ ├── CacheKeyValuePairCell.cs
│ ├── CacheListEntryCell.cs
│ ├── CacheMemberCell.cs
│ └── CacheObjectCell.cs
├── Config
├── ConfigElement.cs
├── ConfigHandler.cs
├── ConfigManager.cs
├── IConfigElement.cs
└── InternalConfigHandler.cs
├── ExplorerBehaviour.cs
├── ExplorerCore.cs
├── Hooks
├── AddHookCell.cs
├── HookCell.cs
├── HookCreator.cs
├── HookInstance.cs
└── HookList.cs
├── Inspectors
├── GameObjectInspector.cs
├── InspectorBase.cs
├── InspectorManager.cs
├── InspectorTab.cs
├── MouseInspector.cs
├── MouseInspectors
│ ├── MouseInspectorBase.cs
│ ├── UiInspector.cs
│ └── WorldInspector.cs
└── ReflectionInspector.cs
├── Loader
├── BepInEx
│ ├── BepInExConfigHandler.cs
│ └── ExplorerBepInPlugin.cs
├── IExplorerLoader.cs
├── MelonLoader
│ ├── ExplorerMelonMod.cs
│ └── MelonLoaderConfigHandler.cs
└── Standalone
│ ├── Editor
│ ├── ExplorerEditorBehaviour.cs
│ └── ExplorerEditorLoader.cs
│ ├── ExplorerStandalone.cs
│ └── StandaloneConfigHandler.cs
├── ObjectExplorer
├── ObjectSearch.cs
├── SceneExplorer.cs
├── SceneHandler.cs
├── SearchProvider.cs
└── UITabPanel.cs
├── Properties
└── AssemblyInfo.cs
├── Runtime
├── Il2CppHelper.cs
├── MonoHelper.cs
├── UERuntimeHelper.cs
└── UnityCrashPrevention.cs
├── Tests
└── TestClass.cs
├── UI
├── DisplayManager.cs
├── ExplorerUIBase.cs
├── Notification.cs
├── Panels
│ ├── AutoCompleteModal.cs
│ ├── CSConsolePanel.cs
│ ├── ClipboardPanel.cs
│ ├── FreeCamPanel.cs
│ ├── HookManagerPanel.cs
│ ├── InspectorPanel.cs
│ ├── LogPanel.cs
│ ├── MouseInspectorResultsPanel.cs
│ ├── ObjectExplorerPanel.cs
│ ├── OptionsPanel.cs
│ ├── UEPanel.cs
│ └── UEPanelDragger.cs
├── UEPanelManager.cs
├── UIManager.cs
└── Widgets
│ ├── AutoComplete
│ ├── EnumCompleter.cs
│ ├── ISuggestionProvider.cs
│ ├── Suggestion.cs
│ └── TypeCompleter.cs
│ ├── EvaluateWidget
│ ├── BaseArgumentHandler.cs
│ ├── EvaluateWidget.cs
│ ├── GenericArgumentHandler.cs
│ ├── GenericConstructorWidget.cs
│ └── ParameterHandler.cs
│ ├── GameObjects
│ ├── AxisControl.cs
│ ├── ComponentCell.cs
│ ├── ComponentList.cs
│ ├── GameObjectControls.cs
│ ├── GameObjectInfoPanel.cs
│ ├── TransformControls.cs
│ ├── TransformType.cs
│ └── Vector3Control.cs
│ ├── TimeScaleWidget.cs
│ └── UnityObjects
│ ├── AudioClipWidget.cs
│ ├── MaterialWidget.cs
│ ├── Texture2DWidget.cs
│ └── UnityObjectWidget.cs
├── UnityExplorer.csproj
├── UnityExplorer.sln
└── nuget.config
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | ko_fi: sinaidev
4 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.yaml:
--------------------------------------------------------------------------------
1 | name: Bug Report
2 | description: File a bug or crash report
3 | title: "[Bug]: "
4 | labels: [bug]
5 | body:
6 | - type: markdown
7 | attributes:
8 | value: |
9 | Thanks for submitting a bug report, please fill out as much detail as possible.
10 | - type: checkboxes
11 | id: latestversion
12 | attributes:
13 | label: Are you on the latest version of UnityExplorer?
14 | description: If not, you must update first.
15 | options:
16 | - label: Yes, I'm on the latest version of UnityExplorer.
17 | required: true
18 | - type: dropdown
19 | id: version
20 | attributes:
21 | label: Which release are you using?
22 | description: Please select your environment for UnityExplorer.
23 | options:
24 | - BepInEx IL2CPP
25 | - BepInEx 6.X Mono
26 | - BepInEx 5.X Mono
27 | - MelonLoader IL2CPP
28 | - MelonLoader Mono
29 | - Standalone IL2CPP
30 | - Standalone Mono
31 | validations:
32 | required: true
33 | - type: textarea
34 | id: game
35 | attributes:
36 | label: Which game did this occur on?
37 | description: Please tell us the name of the game. If it's a personal or private project, just let us know the Unity version.
38 | validations:
39 | required: true
40 | - type: textarea
41 | id: what-happened
42 | attributes:
43 | label: Describe the issue.
44 | description: What happened? Should something else have happened instead? Please provide steps to reproduce the issue if possible.
45 | placeholder: Tell us what you see!
46 | validations:
47 | required: true
48 | - type: textarea
49 | id: logs
50 | attributes:
51 | label: Relevant log output
52 | description: |
53 | Please copy and paste any relevant logs and stack traces.
54 | * Unity log: `%userprofile%\AppData\LocalLow\{Company}\{Game}\Player.log` or `output_log.txt`
55 | * BepInEx: `BepInEx\LogOutput.log`
56 | * MelonLoader: `MelonLoader\latest.log`
57 | * Standalone: `{DLL_Location}\UnityExplorer\Logs\` (pick the most recent one)
58 | render: shell
59 | validations:
60 | required: false
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/config.yml:
--------------------------------------------------------------------------------
1 | blank_issues_enabled: false
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/enhancement.yaml:
--------------------------------------------------------------------------------
1 | name: New feature or enhancement
2 | description: Suggest or discuss a feature or enhancement for UnityExplorer
3 | title: "[Enhancement]: "
4 | labels: [enhancement]
5 | body:
6 | - type: markdown
7 | attributes:
8 | value: |
9 | Thanks for taking the time to discuss UnityExplorer, please provide as much detail as possible.
10 | - type: textarea
11 | id: description
12 | attributes:
13 | label: Describe the new feature or enhancement
14 | description: |
15 | Please go into as much detail as necessary in describing the new feature or enhancement.
16 | If providing examples or suggestions for the required C# code, please use syntax-highlighted code blocks.
17 | validations:
18 | required: true
19 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/other.yaml:
--------------------------------------------------------------------------------
1 | name: Other
2 | description: Something else?
3 | title: "[Other]: "
4 | labels: [Other]
5 | body:
6 | - type: textarea
7 | id: description
8 | attributes:
9 | label: Describe the issue
10 | description: |
11 | Please describe the issue in as much detail as possible.
12 | validations:
13 | required: true
14 |
--------------------------------------------------------------------------------
/.github/workflows/dotnet.yml:
--------------------------------------------------------------------------------
1 | name: Build UnityExplorer
2 |
3 | # Controls when the action will run.
4 | on:
5 | push:
6 | branches: [master]
7 | # Allows you to run this workflow manually from the Actions tab
8 | workflow_dispatch:
9 |
10 | jobs:
11 | build:
12 | runs-on: windows-latest
13 | if: "!contains(github.event.head_commit.message, '-noci')"
14 |
15 | steps:
16 | # Setup
17 |
18 | - name: Checkout latest
19 | uses: actions/checkout@v2
20 |
21 | - name: Setup dotnet
22 | uses: actions/setup-dotnet@v2
23 | with:
24 | dotnet-version: '6.0.x'
25 | include-prerelease: true
26 |
27 | # Run build script
28 | - run: |
29 | ./build.ps1
30 |
31 | # Upload artifacts
32 |
33 | # BepInEx IL2CPP
34 | - uses: actions/upload-artifact@v2
35 | with:
36 | name: UnityExplorer.BepInEx.IL2CPP.zip
37 | path: ./Release/UnityExplorer.BepInEx.IL2CPP/
38 |
39 | # BepInEx IL2CPP CoreCLR
40 | - uses: actions/upload-artifact@v2
41 | with:
42 | name: UnityExplorer.BepInEx.IL2CPP.CoreCLR.zip
43 | path: ./Release/UnityExplorer.BepInEx.IL2CPP.CoreCLR/
44 |
45 | # BepInEx 5 Mono
46 | - uses: actions/upload-artifact@v2
47 | with:
48 | name: UnityExplorer.BepInEx5.Mono.zip
49 | path: ./Release/UnityExplorer.BepInEx5.Mono/
50 |
51 | # BepInEx 6 Mono
52 | - uses: actions/upload-artifact@v2
53 | with:
54 | name: UnityExplorer.BepInEx6.Mono.zip
55 | path: ./Release/UnityExplorer.BepInEx6.Mono/
56 |
57 | # Editor
58 | - uses: actions/upload-artifact@v2
59 | with:
60 | name: UnityExplorer.Editor.zip
61 | path: ./UnityEditorPackage/
62 |
63 | # MelonLoader IL2CPP net6preview
64 | - uses: actions/upload-artifact@v2
65 | with:
66 | name: UnityExplorer.MelonLoader.IL2CPP.net6preview.zip
67 | path: ./Release/UnityExplorer.MelonLoader.IL2CPP.net6preview/
68 |
69 | # MelonLoader IL2CPP net472
70 | - uses: actions/upload-artifact@v2
71 | with:
72 | name: UnityExplorer.MelonLoader.IL2CPP.zip
73 | path: ./Release/UnityExplorer.MelonLoader.IL2CPP/
74 |
75 | # MelonLoader Mono
76 | - uses: actions/upload-artifact@v2
77 | with:
78 | name: UnityExplorer.MelonLoader.Mono.zip
79 | path: ./Release/UnityExplorer.MelonLoader.Mono/
80 |
81 | # Standalone Il2Cpp
82 | - uses: actions/upload-artifact@v2
83 | with:
84 | name: UnityExplorer.Standalone.IL2CPP.zip
85 | path: ./Release/UnityExplorer.Standalone.IL2CPP/
86 |
87 | # Standalone Mono
88 | - uses: actions/upload-artifact@v2
89 | with:
90 | name: UnityExplorer.Standalone.Mono.zip
91 | path: ./Release/UnityExplorer.Standalone.Mono/
92 |
93 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ## Changelog
2 |
3 | ### 4.10.5
4 | - Add ECS Unity Explorer to VRising community
5 |
6 |
7 | All changes
8 |
9 | ### 4.10.4
10 | - Add support for ECS v0.17. Some features might not work on it, like name system.
11 |
12 | ### 4.10.3
13 | - Fix issues when `GetName` or `SetName` are stripped
14 |
15 | ### 4.10.2
16 | - Allow inspecting Buffer components
17 | - Add more filters for World Explorer
18 | - Fixed that reflection inspector always refreshed
19 | - Fixed that new tabs were opened for existing entities
20 |
21 | ### 4.10.1
22 | - Fixed issue where Entity Inspector Tabs did not have [ECS] in their name.
23 |
24 | ### 4.10.0
25 | - Released ECS Unity Explorer Extension
26 |
27 | * Previous versions skipped *
28 |
29 |
--------------------------------------------------------------------------------
/ECSExtension/BufferView.cs:
--------------------------------------------------------------------------------
1 | using ECSExtension.Util;
2 |
3 | namespace ECSExtension
4 | {
5 | public class BufferView where T : unmanaged
6 | {
7 | public readonly ModDynamicBuffer buffer;
8 |
9 | public BufferView(ModDynamicBuffer buffer)
10 | {
11 | this.buffer = buffer;
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/ECSExtension/CacheComponent.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using ECSExtension.Util;
3 | using Unity.Entities;
4 | using UnityExplorer;
5 | using UnityExplorer.CacheObject;
6 | using UnityExplorer.CacheObject.Views;
7 | using UniverseLib.Runtime;
8 |
9 | namespace ECSExtension
10 | {
11 | public sealed class CacheComponent : CacheObjectBase where T : unmanaged
12 | {
13 | private EntityManager entityManager;
14 | private Entity entity;
15 |
16 | public CacheComponent(EntityInspector inspector)
17 | {
18 | Owner = inspector;
19 | entityManager = inspector.currentWorld.EntityManager;
20 | entity = inspector.currentEntity;
21 | SetFallbackType(typeof(T));
22 | }
23 |
24 | public override bool ShouldAutoEvaluate => true;
25 | public override bool HasArguments => false;
26 | public override bool CanWrite => true;
27 | public override bool RefreshFromSource => true;
28 |
29 |
30 | public override void TrySetUserValue(object value)
31 | {
32 | if (value is T component)
33 | {
34 | entityManager.SetModComponentData(entity, component);
35 | }
36 | }
37 |
38 | protected override bool TryAutoEvaluateIfUnitialized(CacheObjectCell objectcell)
39 | {
40 | CacheMemberCell cell = objectcell as CacheMemberCell;
41 | cell.EvaluateHolder.SetActive(false);
42 |
43 | if (State == ValueState.NotEvaluated)
44 | SetValueFromSource(TryEvaluate());
45 |
46 | return true;
47 | }
48 |
49 | public override object TryEvaluate()
50 | {
51 | try
52 | {
53 | return entityManager.GetModComponentData(entity);
54 | }
55 | catch (Exception e)
56 | {
57 | ExplorerCore.LogWarning(e);
58 | }
59 |
60 | return null;
61 | }
62 | }
63 | }
--------------------------------------------------------------------------------
/ECSExtension/Extension.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using BepInEx.Logging;
4 | using ECSExtension.Panels;
5 | using ECSExtension.Patch;
6 | using ECSExtension.Util;
7 | using HarmonyLib;
8 | using Unity.Entities;
9 | using UnityExplorer;
10 | using UnityExplorer.Inspectors;
11 | using UnityExplorer.UI;
12 | using UnityExplorer.UI.Panels;
13 | using UniverseLib.Runtime;
14 |
15 | namespace ECSExtension
16 | {
17 | public static class Extension
18 | {
19 | public const string PLUGIN_NAME = "ECS Inspector Extension";
20 |
21 | public const string PLUGIN_GUID = "org.kremnev8.plugin.ecs-inspector-extension";
22 |
23 | public const string VERSION = "1.0.2";
24 |
25 | public static Harmony Harmony;
26 | public static ManualLogSource logger;
27 |
28 | public static void Load(ManualLogSource log)
29 | {
30 | logger = log;
31 | if (ECSInitialize.CurrentECSVersion == ECSInitialize.ECSVersion.NOT_USED) return;
32 |
33 | Harmony = new Harmony(PLUGIN_GUID);
34 | Harmony.PatchAll(typeof(GameObjectConversionMappingSystem_Patch));
35 |
36 | InspectorManager.customInspectors.Add(EntityAdder);
37 | InspectorManager.equalityCheckers.Add(typeof(Entity), EntityEqualityChecker);
38 | UIManager.onInit += UIManagerOnInit;
39 | logger.LogInfo("Added Entity Inspector");
40 | }
41 |
42 | private static void UIManagerOnInit()
43 | {
44 | ObjectExplorerPanel explorerPanel = UIManager.GetPanel(UIManager.Panels.ObjectExplorer);
45 | explorerPanel.AddTab(new WorldExplorer(explorerPanel));
46 | logger.LogInfo("Added World Explorer");
47 | }
48 |
49 | private static bool EntityEqualityChecker(object o1, object o2)
50 | {
51 | if (o1 is Entity e1 && o2 is Entity e2)
52 | {
53 | return e1.Equals(e2);
54 | }
55 |
56 | return false;
57 | }
58 |
59 | private static Type EntityAdder(object o)
60 | {
61 | if (o is Entity)
62 | {
63 | return typeof(EntityInspector);
64 | }
65 |
66 | return null;
67 | }
68 |
69 | public static bool Unload()
70 | {
71 | if (ECSInitialize.CurrentECSVersion == ECSInitialize.ECSVersion.NOT_USED) return true;
72 | Harmony.UnpatchSelf();
73 | List entityInspectors = new List();
74 | foreach (InspectorBase inspector in InspectorManager.Inspectors)
75 | {
76 | if (inspector is EntityInspector)
77 | {
78 | entityInspectors.Add(inspector);
79 | }
80 | }
81 |
82 | foreach (InspectorBase inspector in entityInspectors)
83 | {
84 | inspector.CloseInspector();
85 | }
86 |
87 | InspectorManager.customInspectors.Remove(EntityAdder);
88 | InspectorManager.equalityCheckers.Remove(typeof(Entity));
89 | logger.LogInfo("Removed Entity Inspector");
90 | return true;
91 | }
92 | }
93 | }
--------------------------------------------------------------------------------
/ECSExtension/ExtensionPlugin.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using BepInEx;
3 | using BepInEx.Unity.Mono;
4 | using UnityExplorer;
5 |
6 | #if CPP
7 | using BepInEx.Unity.IL2CPP;
8 | #endif
9 |
10 | namespace ECSExtension
11 | {
12 | [BepInPlugin(Extension.PLUGIN_GUID, Extension.PLUGIN_NAME, Extension.VERSION)]
13 | [BepInDependency(ExplorerCore.GUID)]
14 | #if CPP
15 | public class ExtensionPlugin : BasePlugin
16 | {
17 | public override void Load()
18 | {
19 | Extension.Load(Log);
20 | }
21 |
22 | public override bool Unload()
23 | {
24 | return Extension.Unload();
25 | }
26 | }
27 | #else
28 | public class ExtensionPlugin : BaseUnityPlugin
29 | {
30 | public void Awake()
31 | {
32 | Extension.Load(Logger);
33 | }
34 |
35 | private void OnDestroy()
36 | {
37 | Extension.Unload();
38 | }
39 | }
40 | #endif
41 | }
--------------------------------------------------------------------------------
/ECSExtension/Inspectors/ButtonNativeListHandler.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using Unity.Collections;
4 | using UniverseLib.UI.Widgets.ButtonList;
5 | using UniverseLib.UI.Widgets.ScrollView;
6 |
7 | namespace ECSExtension
8 | {
9 | public class ButtonNativeListHandler : ICellPoolDataSource where TCell : ButtonCell where TData : unmanaged
10 | {
11 | protected Func> GetEntries;
12 | protected Action SetICell;
13 | protected Func ShouldDisplay;
14 | protected Action OnCellClicked;
15 | private string currentFilter;
16 |
17 | public ScrollPool ScrollPool { get; private set; }
18 |
19 | public int ItemCount => CurrentEntries.Count;
20 |
21 | public List CurrentEntries { get; } = new List();
22 |
23 | public string CurrentFilter
24 | {
25 | get => currentFilter;
26 | set => currentFilter = value ?? "";
27 | }
28 |
29 | /// Create a wrapper to handle your Button ScrollPool.
30 | /// The ScrollPool<ButtonCell> you have already created.
31 | /// A method which should return your current data values.
32 | /// A method which should set the data at the int index to the cell.
33 | /// A method which should determine if the data at the index should be displayed, with an optional string filter from CurrentFilter.
34 | /// A method invoked when a cell is clicked, containing the data index assigned to the cell.
35 | public ButtonNativeListHandler(
36 | ScrollPool scrollPool,
37 | Func> getEntriesMethod,
38 | Action setICellMethod,
39 | Func shouldDisplayMethod,
40 | Action onCellClickedMethod)
41 | {
42 | ScrollPool = scrollPool;
43 | GetEntries = getEntriesMethod;
44 | SetICell = setICellMethod;
45 | ShouldDisplay = shouldDisplayMethod;
46 | OnCellClicked = onCellClickedMethod;
47 | }
48 |
49 | public void RefreshData()
50 | {
51 | NativeArray dataList = GetEntries();
52 | CurrentEntries.Clear();
53 | foreach (TData data in dataList)
54 | {
55 | if (!string.IsNullOrEmpty(currentFilter))
56 | {
57 | if (ShouldDisplay(data, currentFilter))
58 | CurrentEntries.Add(data);
59 | }
60 | else
61 | CurrentEntries.Add(data);
62 | }
63 | }
64 |
65 | public virtual void OnCellBorrowed(TCell cell)
66 | {
67 | cell.OnClick += OnCellClicked;
68 | }
69 |
70 | public virtual void SetCell(TCell cell, int index)
71 | {
72 | if (CurrentEntries == null)
73 | RefreshData();
74 | if (index < 0 || index >= CurrentEntries.Count)
75 | {
76 | cell.Disable();
77 | }
78 | else
79 | {
80 | cell.Enable();
81 | cell.CurrentDataIndex = index;
82 | SetICell(cell, index);
83 | }
84 | }
85 | }
86 | }
--------------------------------------------------------------------------------
/ECSExtension/Inspectors/ECSComponentCell.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using ECSExtension.Util;
3 | using Unity.Entities;
4 | using UnityEngine;
5 | using UnityEngine.UI;
6 | using UniverseLib.Runtime;
7 | using UniverseLib.UI;
8 | using UniverseLib.UI.Models;
9 | using UniverseLib.UI.Widgets.ButtonList;
10 |
11 | #if CPP
12 | using Type = Il2CppSystem.Type;
13 | #endif
14 |
15 | namespace ECSExtension
16 | {
17 | public class ECSComponentCell : ButtonCell
18 | {
19 | public ButtonRef DestroyButton;
20 | public Text typeLabel;
21 |
22 | public Action OnDestroyClicked;
23 |
24 | public void ConfigureCell(ComponentType type)
25 | {
26 | Type monoType = type.GetManagedType();
27 | TypeManager.TypeInfo typeInfo = ECSHelper.GetTypeInfo(type.TypeIndex);
28 |
29 | Button.ButtonText.text = monoType.ToString();
30 | typeLabel.text = GetCategoryText(typeInfo.Category);
31 |
32 | }
33 |
34 | private string GetCategoryText(TypeManager.TypeCategory category)
35 | {
36 | switch (category)
37 | {
38 | case TypeManager.TypeCategory.ComponentData:
39 | return "Component";
40 | case TypeManager.TypeCategory.BufferData:
41 | return "Buffer";
42 | case TypeManager.TypeCategory.ISharedComponentData:
43 | return "Shared";
44 | case TypeManager.TypeCategory.EntityData:
45 | return "Entity";
46 | case TypeManager.TypeCategory.UnityEngineObject:
47 | return "UObject";
48 | default:
49 | return "";
50 | }
51 | }
52 |
53 | private void DestroyClicked()
54 | {
55 | OnDestroyClicked?.Invoke(CurrentDataIndex);
56 | }
57 |
58 | public override GameObject CreateContent(GameObject parent)
59 | {
60 | var root = base.CreateContent(parent);
61 |
62 | // Add mask to button so text doesnt overlap on Close button
63 | //this.Button.Component.gameObject.AddComponent().showMaskGraphic = true;
64 | this.Button.ButtonText.horizontalOverflow = HorizontalWrapMode.Wrap;
65 |
66 | typeLabel = UIFactory.CreateLabel(UIRoot, "TypeLabel", "Component", TextAnchor.MiddleCenter);
67 | UIFactory.SetLayoutElement(typeLabel.gameObject, minHeight: 21, minWidth: 100);
68 |
69 | DestroyButton = UIFactory.CreateButton(UIRoot, "DestroyButton", "X", new Color(0.3f, 0.2f, 0.2f));
70 | UIFactory.SetLayoutElement(DestroyButton.Component.gameObject, minHeight: 21, minWidth: 25);
71 | DestroyButton.OnClick += DestroyClicked;
72 |
73 | return root;
74 | }
75 | }
76 | }
--------------------------------------------------------------------------------
/ECSExtension/Inspectors/ECSComponentList.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using ECSExtension.Util;
4 | using HarmonyLib;
5 | using Unity.Collections;
6 | using Unity.Entities;
7 | using UnityExplorer;
8 | using UniverseLib;
9 | using UniverseLib.Runtime;
10 | using UniverseLib.UI.Widgets.ScrollView;
11 |
12 | #if CPP
13 | using Type = Il2CppSystem.Type;
14 | #endif
15 |
16 | namespace ECSExtension
17 | {
18 | public class ECSComponentList : ButtonNativeListHandler
19 | {
20 | public EntityInspector Parent;
21 |
22 | public ECSComponentList(ScrollPool scrollPool, Func> getEntriesMethod)
23 | : base(scrollPool, getEntriesMethod, null, null, null)
24 | {
25 | SetICell = SetComponentCell;
26 | ShouldDisplay = CheckShouldDisplay;
27 | OnCellClicked = OnComponentClicked;
28 | }
29 |
30 | public void Clear()
31 | {
32 | RefreshData();
33 | ScrollPool.Refresh(true, true);
34 | }
35 |
36 | private bool CheckShouldDisplay(ComponentType _, string __) => true;
37 |
38 | public override void OnCellBorrowed(ECSComponentCell cell)
39 | {
40 | base.OnCellBorrowed(cell);
41 |
42 | cell.OnDestroyClicked += OnDestroyClicked;
43 | }
44 |
45 | private void OnComponentClicked(int index)
46 | {
47 | var entries = GetEntries();
48 |
49 | if (index < 0 || index >= entries.Length)
50 | return;
51 |
52 | ComponentType comp = entries[index];
53 | InvokeForComponent(comp, nameof(InspectComponent));
54 | }
55 |
56 | private void InvokeForComponent(ComponentType comp, string methodName)
57 | {
58 | Type componentType = comp.GetManagedType();
59 | #if CPP
60 | System.Type monoType = Il2CppReflection.GetUnhollowedType(componentType);
61 | #else
62 | Type monoType = componentType;
63 | #endif
64 | var method = typeof(ECSComponentList).GetMethod(methodName, AccessTools.all);
65 | method.MakeGenericMethod(monoType)
66 | .Invoke(this, Array.Empty