mirror of
https://github.com/GrahamKracker/UnityExplorer.git
synced 2025-07-05 04:42:54 +08:00
Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
4e3d3a2e5c | |||
7dbc8fd66e | |||
892cefcc91 | |||
a986b92963 | |||
8837119781 | |||
7eda249ddb | |||
710b4ba74a | |||
4bee55fb25 | |||
c71748d22a | |||
621035c732 |
@ -45,7 +45,7 @@
|
|||||||
|
|
||||||
The standalone release can be used with any injector or loader of your choice, but it requires you to load the dependencies manually.
|
The standalone release can be used with any injector or loader of your choice, but it requires you to load the dependencies manually.
|
||||||
|
|
||||||
1. Ensure the required libs are loaded - UniverseLib, HarmonyX and MonoMod
|
1. Ensure the required libs are loaded - UniverseLib, HarmonyX and MonoMod. Take them from the [`UnityExplorer.Editor`](https://github.com/sinai-dev/UnityExplorer/releases/latest/download/UnityExplorer.Editor.zip) release if you need them.
|
||||||
2. For IL2CPP, load Il2CppAssemblyUnhollower and start an [Il2CppAssemblyUnhollower runtime](https://github.com/knah/Il2CppAssemblyUnhollower#required-external-setup)
|
2. For IL2CPP, load Il2CppAssemblyUnhollower and start an [Il2CppAssemblyUnhollower runtime](https://github.com/knah/Il2CppAssemblyUnhollower#required-external-setup)
|
||||||
2. Load the UnityExplorer DLL
|
2. Load the UnityExplorer DLL
|
||||||
3. Create an instance of Unity Explorer with `UnityExplorer.ExplorerStandalone.CreateInstance();`
|
3. Create an instance of Unity Explorer with `UnityExplorer.ExplorerStandalone.CreateInstance();`
|
||||||
|
@ -14,7 +14,7 @@ namespace UnityExplorer.CacheObject
|
|||||||
{
|
{
|
||||||
public static class CacheMemberFactory
|
public static class CacheMemberFactory
|
||||||
{
|
{
|
||||||
public static List<CacheMember> GetCacheMembers(object inspectorTarget, Type type, ReflectionInspector inspector)
|
public static List<CacheMember> GetCacheMembers(Type type, ReflectionInspector inspector)
|
||||||
{
|
{
|
||||||
//var list = new List<CacheMember>();
|
//var list = new List<CacheMember>();
|
||||||
HashSet<string> cachedSigs = new();
|
HashSet<string> cachedSigs = new();
|
||||||
@ -49,10 +49,6 @@ namespace UnityExplorer.CacheObject
|
|||||||
|
|
||||||
foreach (var declaringType in types)
|
foreach (var declaringType in types)
|
||||||
{
|
{
|
||||||
var target = inspectorTarget;
|
|
||||||
if (!inspector.StaticOnly)
|
|
||||||
target = target.TryCast(declaringType);
|
|
||||||
|
|
||||||
foreach (var prop in declaringType.GetProperties(flags))
|
foreach (var prop in declaringType.GetProperties(flags))
|
||||||
if (prop.DeclaringType == declaringType)
|
if (prop.DeclaringType == declaringType)
|
||||||
TryCacheMember(prop, props, cachedSigs, declaringType, inspector);
|
TryCacheMember(prop, props, cachedSigs, declaringType, inspector);
|
||||||
@ -79,13 +75,9 @@ namespace UnityExplorer.CacheObject
|
|||||||
return sorted;
|
return sorted;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void TryCacheMember(
|
static void TryCacheMember<T>(MemberInfo member, List<T> list, HashSet<string> cachedSigs,
|
||||||
MemberInfo member,
|
Type declaringType, ReflectionInspector inspector, bool ignorePropertyMethodInfos = true)
|
||||||
IList list,
|
where T : CacheMember
|
||||||
HashSet<string> cachedSigs,
|
|
||||||
Type declaringType,
|
|
||||||
ReflectionInspector inspector,
|
|
||||||
bool ignorePropertyMethodInfos = true)
|
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -94,7 +86,9 @@ namespace UnityExplorer.CacheObject
|
|||||||
|
|
||||||
string sig = member switch
|
string sig = member switch
|
||||||
{
|
{
|
||||||
|
// method or constructor
|
||||||
MethodBase mb => mb.FullDescription(),
|
MethodBase mb => mb.FullDescription(),
|
||||||
|
// property or field
|
||||||
PropertyInfo or FieldInfo => $"{member.DeclaringType.FullDescription()}.{member.Name}",
|
PropertyInfo or FieldInfo => $"{member.DeclaringType.FullDescription()}.{member.Name}",
|
||||||
_ => throw new NotImplementedException(),
|
_ => throw new NotImplementedException(),
|
||||||
};
|
};
|
||||||
@ -164,32 +158,13 @@ namespace UnityExplorer.CacheObject
|
|||||||
cached.SetFallbackType(returnType);
|
cached.SetFallbackType(returnType);
|
||||||
cached.SetInspectorOwner(inspector, member);
|
cached.SetInspectorOwner(inspector, member);
|
||||||
|
|
||||||
list.Add(cached);
|
list.Add((T)cached);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
ExplorerCore.LogWarning($"Exception caching member {member.DeclaringType.FullName}.{member.Name}!");
|
ExplorerCore.LogWarning($"Exception caching member {member.DeclaringType.FullName}.{member.Name}!");
|
||||||
ExplorerCore.Log(e.ToString());
|
ExplorerCore.Log(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//internal static string GetSig(MemberInfo member) => $"{member.DeclaringType.Name}.{member.Name}";
|
|
||||||
//
|
|
||||||
//internal static string GetArgumentString(ParameterInfo[] args)
|
|
||||||
//{
|
|
||||||
// var sb = new StringBuilder();
|
|
||||||
// sb.Append(' ');
|
|
||||||
// sb.Append('(');
|
|
||||||
// foreach (var param in args)
|
|
||||||
// {
|
|
||||||
// sb.Append(param.ParameterType.Name);
|
|
||||||
// sb.Append(' ');
|
|
||||||
// sb.Append(param.Name);
|
|
||||||
// sb.Append(',');
|
|
||||||
// sb.Append(' ');
|
|
||||||
// }
|
|
||||||
// sb.Append(')');
|
|
||||||
// return sb.ToString();
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
using System.IO;
|
using System;
|
||||||
|
using System.IO;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using UnityExplorer.CacheObject;
|
||||||
using UnityExplorer.Config;
|
using UnityExplorer.Config;
|
||||||
using UnityExplorer.ObjectExplorer;
|
using UnityExplorer.ObjectExplorer;
|
||||||
using UnityExplorer.Runtime;
|
using UnityExplorer.Runtime;
|
||||||
using UnityExplorer.UI;
|
using UnityExplorer.UI;
|
||||||
using UnityExplorer.UI.Panels;
|
using UnityExplorer.UI.Panels;
|
||||||
|
using UniverseLib;
|
||||||
using UniverseLib.Input;
|
using UniverseLib.Input;
|
||||||
|
|
||||||
namespace UnityExplorer
|
namespace UnityExplorer
|
||||||
@ -12,7 +15,7 @@ namespace UnityExplorer
|
|||||||
public static class ExplorerCore
|
public static class ExplorerCore
|
||||||
{
|
{
|
||||||
public const string NAME = "UnityExplorer";
|
public const string NAME = "UnityExplorer";
|
||||||
public const string VERSION = "4.6.0";
|
public const string VERSION = "4.6.2";
|
||||||
public const string AUTHOR = "Sinai";
|
public const string AUTHOR = "Sinai";
|
||||||
public const string GUID = "com.sinai.unityexplorer";
|
public const string GUID = "com.sinai.unityexplorer";
|
||||||
|
|
||||||
@ -26,23 +29,20 @@ namespace UnityExplorer
|
|||||||
public static void Init(IExplorerLoader loader)
|
public static void Init(IExplorerLoader loader)
|
||||||
{
|
{
|
||||||
if (Loader != null)
|
if (Loader != null)
|
||||||
{
|
throw new Exception("UnityExplorer is already loaded.");
|
||||||
LogWarning("UnityExplorer is already loaded!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Loader = loader;
|
Loader = loader;
|
||||||
|
|
||||||
Log($"{NAME} {VERSION} initializing...");
|
Log($"{NAME} {VERSION} initializing...");
|
||||||
|
|
||||||
if (!Directory.Exists(Loader.ExplorerFolder))
|
|
||||||
Directory.CreateDirectory(Loader.ExplorerFolder);
|
Directory.CreateDirectory(Loader.ExplorerFolder);
|
||||||
|
|
||||||
ConfigManager.Init(Loader.ConfigHandler);
|
ConfigManager.Init(Loader.ConfigHandler);
|
||||||
|
|
||||||
UERuntimeHelper.Init();
|
UERuntimeHelper.Init();
|
||||||
ExplorerBehaviour.Setup();
|
ExplorerBehaviour.Setup();
|
||||||
UnityCrashPrevention.Init();
|
UnityCrashPrevention.Init();
|
||||||
|
|
||||||
UniverseLib.Universe.Init(ConfigManager.Startup_Delay_Time.Value, LateInit, Log, new()
|
Universe.Init(ConfigManager.Startup_Delay_Time.Value, LateInit, Log, new()
|
||||||
{
|
{
|
||||||
Disable_EventSystem_Override = ConfigManager.Disable_EventSystem_Override.Value,
|
Disable_EventSystem_Override = ConfigManager.Disable_EventSystem_Override.Value,
|
||||||
Force_Unlock_Mouse = ConfigManager.Force_Unlock_Mouse.Value,
|
Force_Unlock_Mouse = ConfigManager.Force_Unlock_Mouse.Value,
|
||||||
@ -53,7 +53,7 @@ namespace UnityExplorer
|
|||||||
// Do a delayed setup so that objects aren't destroyed instantly.
|
// Do a delayed setup so that objects aren't destroyed instantly.
|
||||||
// This can happen for a multitude of reasons.
|
// This can happen for a multitude of reasons.
|
||||||
// Default delay is 1 second which is usually enough.
|
// Default delay is 1 second which is usually enough.
|
||||||
private static void LateInit()
|
static void LateInit()
|
||||||
{
|
{
|
||||||
Log($"Setting up late core features...");
|
Log($"Setting up late core features...");
|
||||||
|
|
||||||
@ -63,21 +63,18 @@ namespace UnityExplorer
|
|||||||
|
|
||||||
UIManager.InitUI();
|
UIManager.InitUI();
|
||||||
|
|
||||||
Log($"{NAME} {VERSION} initialized for {UniverseLib.Universe.Context}.");
|
Log($"{NAME} {VERSION} ({Universe.Context}) initialized.");
|
||||||
|
|
||||||
//InspectorManager.Inspect(typeof(Tests.TestClass));
|
//InspectorManager.Inspect(typeof(Tests.TestClass));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
internal static void Update()
|
||||||
/// Should be called once per frame.
|
|
||||||
/// </summary>
|
|
||||||
public static void Update()
|
|
||||||
{
|
{
|
||||||
UIManager.Update();
|
|
||||||
|
|
||||||
// check master toggle
|
// check master toggle
|
||||||
if (InputManager.GetKeyDown(ConfigManager.Master_Toggle.Value))
|
if (InputManager.GetKeyDown(ConfigManager.Master_Toggle.Value))
|
||||||
UIManager.ShowMenu = !UIManager.ShowMenu;
|
UIManager.ShowMenu = !UIManager.ShowMenu;
|
||||||
|
|
||||||
|
UIManager.Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
#region LOGGING
|
#region LOGGING
|
||||||
|
@ -160,11 +160,12 @@ namespace UnityExplorer.Inspectors
|
|||||||
|
|
||||||
// Unity object helper widget
|
// Unity object helper widget
|
||||||
|
|
||||||
|
if (!StaticOnly)
|
||||||
this.UnityWidget = UnityObjectWidget.GetUnityWidget(target, TargetType, this);
|
this.UnityWidget = UnityObjectWidget.GetUnityWidget(target, TargetType, this);
|
||||||
|
|
||||||
// Get cache members
|
// Get cache members
|
||||||
|
|
||||||
this.members = CacheMemberFactory.GetCacheMembers(Target, TargetType, this);
|
this.members = CacheMemberFactory.GetCacheMembers(TargetType, this);
|
||||||
|
|
||||||
// reset filters
|
// reset filters
|
||||||
|
|
||||||
|
@ -73,6 +73,10 @@ namespace UnityExplorer.Loader.Standalone
|
|||||||
return bool.Parse(value);
|
return bool.Parse(value);
|
||||||
else if (elementType == typeof(int))
|
else if (elementType == typeof(int))
|
||||||
return int.Parse(value);
|
return int.Parse(value);
|
||||||
|
else if (elementType == typeof(float))
|
||||||
|
return float.Parse(value);
|
||||||
|
else if (elementType.IsEnum)
|
||||||
|
return Enum.Parse(elementType, value);
|
||||||
else
|
else
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ namespace UnityExplorer.ObjectExplorer
|
|||||||
private static Scene? selectedScene;
|
private static Scene? selectedScene;
|
||||||
|
|
||||||
/// <summary>The GameObjects in the currently inspected scene.</summary>
|
/// <summary>The GameObjects in the currently inspected scene.</summary>
|
||||||
public static GameObject[] CurrentRootObjects { get; private set; } = new GameObject[0];
|
public static IEnumerable<GameObject> CurrentRootObjects { get; private set; } = new GameObject[0];
|
||||||
|
|
||||||
/// <summary>All currently loaded Scenes.</summary>
|
/// <summary>All currently loaded Scenes.</summary>
|
||||||
public static List<Scene> LoadedScenes { get; private set; } = new();
|
public static List<Scene> LoadedScenes { get; private set; } = new();
|
||||||
@ -129,7 +129,7 @@ namespace UnityExplorer.ObjectExplorer
|
|||||||
if (go.transform.parent == null && !go.scene.IsValid())
|
if (go.transform.parent == null && !go.scene.IsValid())
|
||||||
objects.Add(go);
|
objects.Add(go);
|
||||||
}
|
}
|
||||||
CurrentRootObjects = objects.ToArray();
|
CurrentRootObjects = objects;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,8 @@ namespace UnityExplorer.Tests
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region MONO
|
||||||
|
|
||||||
public static object LiterallyAnything = null;
|
public static object LiterallyAnything = null;
|
||||||
|
|
||||||
// Test enumerables
|
// Test enumerables
|
||||||
@ -145,6 +147,8 @@ namespace UnityExplorer.Tests
|
|||||||
ExplorerCore.Log("Finished TestClass Init_Mono");
|
ExplorerCore.Log("Finished TestClass Init_Mono");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#if CPP
|
#if CPP
|
||||||
public static Il2CppSystem.Collections.Generic.Dictionary<string, string> IL2CPP_Dict;
|
public static Il2CppSystem.Collections.Generic.Dictionary<string, string> IL2CPP_Dict;
|
||||||
public static Il2CppSystem.Collections.Generic.HashSet<string> IL2CPP_HashSet;
|
public static Il2CppSystem.Collections.Generic.HashSet<string> IL2CPP_HashSet;
|
||||||
@ -257,6 +261,7 @@ namespace UnityExplorer.Tests
|
|||||||
|
|
||||||
ExplorerCore.Log($"Finished Init_Il2Cpp");
|
ExplorerCore.Log($"Finished Init_Il2Cpp");
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,7 @@ namespace UnityExplorer.UI
|
|||||||
|
|
||||||
DisplayManager.Init();
|
DisplayManager.Init();
|
||||||
|
|
||||||
var display = DisplayManager.ActiveDisplay;
|
Display display = DisplayManager.ActiveDisplay;
|
||||||
lastScreenWidth = display.renderingWidth;
|
lastScreenWidth = display.renderingWidth;
|
||||||
lastScreenHeight = display.renderingHeight;
|
lastScreenHeight = display.renderingHeight;
|
||||||
|
|
||||||
|
@ -28,17 +28,16 @@ namespace UnityExplorer.UI.Widgets
|
|||||||
if (!typeof(UnityEngine.Object).IsAssignableFrom(targetType))
|
if (!typeof(UnityEngine.Object).IsAssignableFrom(targetType))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
UnityObjectWidget ret;
|
UnityObjectWidget widget = target switch
|
||||||
|
{
|
||||||
|
Texture2D => Pool<Texture2DWidget>.Borrow(),
|
||||||
|
AudioClip => Pool<AudioClipWidget>.Borrow(),
|
||||||
|
_ => Pool<UnityObjectWidget>.Borrow()
|
||||||
|
};
|
||||||
|
|
||||||
if (targetType == typeof(Texture2D))
|
widget.OnBorrowed(target, targetType, inspector);
|
||||||
ret = Pool<Texture2DWidget>.Borrow();
|
|
||||||
else if (targetType == typeof(AudioClip))
|
|
||||||
ret = Pool<AudioClipWidget>.Borrow();
|
|
||||||
else
|
|
||||||
ret = Pool<UnityObjectWidget>.Borrow();
|
|
||||||
|
|
||||||
ret.OnBorrowed(target, targetType, inspector);
|
return widget;
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void OnBorrowed(object target, Type targetType, ReflectionInspector inspector)
|
public virtual void OnBorrowed(object target, Type targetType, ReflectionInspector inspector)
|
||||||
@ -52,7 +51,7 @@ namespace UnityExplorer.UI.Widgets
|
|||||||
|
|
||||||
this.UIRoot.transform.SetSiblingIndex(inspector.UIRoot.transform.childCount - 2);
|
this.UIRoot.transform.SetSiblingIndex(inspector.UIRoot.transform.childCount - 2);
|
||||||
|
|
||||||
UnityObjectRef = (UnityEngine.Object)target.TryCast(typeof(UnityEngine.Object));
|
UnityObjectRef = target.TryCast<UnityEngine.Object>();
|
||||||
UIRoot.SetActive(true);
|
UIRoot.SetActive(true);
|
||||||
|
|
||||||
nameInput.Text = UnityObjectRef.name;
|
nameInput.Text = UnityObjectRef.name;
|
||||||
|
@ -175,13 +175,13 @@
|
|||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="UniverseLib.Mono">
|
<Reference Include="UniverseLib.Mono">
|
||||||
<HintPath>packages\UniverseLib.1.2.16\lib\net35\UniverseLib.Mono.dll</HintPath>
|
<HintPath>packages\UniverseLib.1.2.17\lib\net35\UniverseLib.Mono.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<!-- Il2Cpp refs -->
|
<!-- Il2Cpp refs -->
|
||||||
<ItemGroup Condition="'$(IsCpp)'=='true'">
|
<ItemGroup Condition="'$(IsCpp)'=='true'">
|
||||||
<Reference Include="UniverseLib.IL2CPP">
|
<Reference Include="UniverseLib.IL2CPP">
|
||||||
<HintPath>packages\UniverseLib.1.2.16\lib\net472\UniverseLib.IL2CPP.dll</HintPath>
|
<HintPath>packages\UniverseLib.1.2.17\lib\net472\UniverseLib.IL2CPP.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="UnhollowerBaseLib, Version=0.4.22.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="UnhollowerBaseLib, Version=0.4.22.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\Il2CppAssemblyUnhollower.BaseLib.0.4.22\lib\net472\UnhollowerBaseLib.dll</HintPath>
|
<HintPath>packages\Il2CppAssemblyUnhollower.BaseLib.0.4.22\lib\net472\UnhollowerBaseLib.dll</HintPath>
|
||||||
|
@ -6,6 +6,6 @@
|
|||||||
<package id="ILRepack.Lib.MSBuild.Task" version="2.0.18.2" targetFramework="net35" />
|
<package id="ILRepack.Lib.MSBuild.Task" version="2.0.18.2" targetFramework="net35" />
|
||||||
<package id="Mono.Cecil" version="0.10.4" targetFramework="net35" />
|
<package id="Mono.Cecil" version="0.10.4" targetFramework="net35" />
|
||||||
<package id="Samboy063.Tomlet" version="3.1.3" targetFramework="net472" />
|
<package id="Samboy063.Tomlet" version="3.1.3" targetFramework="net472" />
|
||||||
<package id="UniverseLib" version="1.2.16" targetFramework="net35" />
|
<package id="UniverseLib" version="1.2.17" targetFramework="net35" />
|
||||||
<package id="UniverseLib.Analyzers" version="1.0.3" targetFramework="net35" developmentDependency="true" />
|
<package id="UniverseLib.Analyzers" version="1.0.3" targetFramework="net35" developmentDependency="true" />
|
||||||
</packages>
|
</packages>
|
Reference in New Issue
Block a user