mirror of
https://github.com/GrahamKracker/UnityExplorer.git
synced 2025-07-01 19:13:03 +08:00
Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
44f54d9190 | |||
3b4ea31b50 | |||
ad7b05f721 |
@ -16,7 +16,7 @@ namespace UnityExplorer
|
||||
public class ExplorerCore
|
||||
{
|
||||
public const string NAME = "UnityExplorer";
|
||||
public const string VERSION = "3.1.2";
|
||||
public const string VERSION = "3.1.4";
|
||||
public const string AUTHOR = "Sinai";
|
||||
public const string GUID = "com.sinai.unityexplorer";
|
||||
public const string EXPLORER_FOLDER = @"Mods\UnityExplorer";
|
||||
|
@ -15,6 +15,16 @@ namespace UnityExplorer.Helpers
|
||||
private static MethodInfo EncodeToPNGMethod => m_encodeToPNGMethod ?? GetEncodeToPNGMethod();
|
||||
private static MethodInfo m_encodeToPNGMethod;
|
||||
|
||||
public static byte[] EncodeToPNGSafe(this Texture2D tex)
|
||||
{
|
||||
var method = EncodeToPNGMethod;
|
||||
|
||||
if (method.IsStatic)
|
||||
return (byte[])method.Invoke(null, new object[] { tex });
|
||||
else
|
||||
return (byte[])method.Invoke(tex, new object[0]);
|
||||
}
|
||||
|
||||
private static MethodInfo GetEncodeToPNGMethod()
|
||||
{
|
||||
if (ReflectionHelpers.GetTypeByName("UnityEngine.ImageConversion") is Type imageConversion)
|
||||
|
@ -272,7 +272,14 @@ namespace UnityExplorer.Inspectors.Reflection
|
||||
if (File.Exists(path))
|
||||
File.Delete(path);
|
||||
|
||||
var data = tex.EncodeToPNG();
|
||||
if (!tex.IsReadable())
|
||||
tex = Texture2DHelpers.ForceReadTexture(tex);
|
||||
#if CPP
|
||||
byte[] data = tex.EncodeToPNG();
|
||||
#else
|
||||
byte[] data = tex.EncodeToPNGSafe();
|
||||
#endif
|
||||
|
||||
File.WriteAllBytes(path, data);
|
||||
}
|
||||
});
|
||||
|
@ -170,7 +170,7 @@ namespace UnityExplorer.UI
|
||||
|
||||
//ExplorerCore.Log("Disabling current event system...");
|
||||
m_lastEventSystem.enabled = false;
|
||||
m_lastEventSystem.gameObject.SetActive(false);
|
||||
//m_lastEventSystem.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
// Set to our current system
|
||||
@ -188,7 +188,7 @@ namespace UnityExplorer.UI
|
||||
if (m_lastEventSystem)
|
||||
{
|
||||
m_lastEventSystem.enabled = true;
|
||||
m_lastEventSystem.gameObject.SetActive(true);
|
||||
//m_lastEventSystem.gameObject.SetActive(true);
|
||||
|
||||
m_settingEventSystem = true;
|
||||
EventSystem.current = m_lastEventSystem;
|
||||
|
@ -229,6 +229,7 @@ namespace UnityExplorer.UI.Modules
|
||||
}
|
||||
|
||||
m_sceneDropdown.transform.Find("Label").GetComponent<Text>().text = "Any";
|
||||
m_sceneFilter = SceneFilter.Any;
|
||||
}
|
||||
|
||||
// ~~~~~ UI Callbacks ~~~~~
|
||||
|
Reference in New Issue
Block a user