diff --git a/vrchat.jordo.easyquestswitch/Editor/EQS_Window.cs b/vrchat.jordo.easyquestswitch/Editor/EQS_Window.cs index f07a110..f09f874 100644 --- a/vrchat.jordo.easyquestswitch/Editor/EQS_Window.cs +++ b/vrchat.jordo.easyquestswitch/Editor/EQS_Window.cs @@ -12,7 +12,7 @@ namespace EasyQuestSwitch public class EQS_Window : EditorWindow { - private const string version = "1.3.0"; + private const string version = "1.3.1"; [MenuItem("Window/Easy Quest Switch")] public static void ShowWindow() diff --git a/vrchat.jordo.easyquestswitch/Runtime/EQS_Data.cs b/vrchat.jordo.easyquestswitch/Runtime/EQS_Data.cs index cfcee21..9d87ec5 100644 --- a/vrchat.jordo.easyquestswitch/Runtime/EQS_Data.cs +++ b/vrchat.jordo.easyquestswitch/Runtime/EQS_Data.cs @@ -25,6 +25,8 @@ public class Data } public List Objects; + public int version = 0; + private const int currentVersion = 131; public void ValidateData(int index) { @@ -111,9 +113,27 @@ public void OnChangedBuildTarget(BuildTarget newTarget) buildInfo.CachedBuildTarget = buildInfo.NewBuildTarget; } + public void Awake() + { + if (currentVersion > version) + { + foreach (Data d in Objects) + { + if (d.Type != null) + { + if(d.Type.GetType() == typeof(Type_Material) || d.Type.GetType() == typeof(Type_Material)) + { + d.Type.Setup(d.Target, version); + } + } + } + version = currentVersion; + } + } + public void OnSceneOpened() { - buildInfo.NewBuildTarget = EditorUserBuildSettings.activeBuildTarget; + /*buildInfo.NewBuildTarget = EditorUserBuildSettings.activeBuildTarget; if (buildInfo.CachedBuildTarget != buildInfo.NewBuildTarget && Objects != null) { string displayDialog = string.Format(EQS_Localization.Current.PopupTargetChanged, buildInfo.NewBuildTarget.ToString()); @@ -122,9 +142,9 @@ public void OnSceneOpened() ApplyTarget(buildInfo.NewBuildTarget); buildInfo.CachedBuildTarget = buildInfo.NewBuildTarget; } - } + }*/ } - + public void ApplyTarget(BuildTarget newTarget) { if(newTarget == BuildTarget.StandaloneWindows64 || newTarget == BuildTarget.Android) diff --git a/vrchat.jordo.easyquestswitch/Runtime/EQS_Types/Type_Base.cs b/vrchat.jordo.easyquestswitch/Runtime/EQS_Types/Type_Base.cs index fe3805c..59f2fc5 100644 --- a/vrchat.jordo.easyquestswitch/Runtime/EQS_Types/Type_Base.cs +++ b/vrchat.jordo.easyquestswitch/Runtime/EQS_Types/Type_Base.cs @@ -8,6 +8,10 @@ namespace EasyQuestSwitch.Types public abstract class Type_Base : MonoBehaviour { public abstract void Setup(Object type); + + // Override without calling base to setup custom migration + public virtual void Setup(Object type, int currentVersion) => Setup(type); + public abstract void Process(Object type, BuildTarget buildTarget); } } diff --git a/vrchat.jordo.easyquestswitch/Runtime/EQS_Types/Type_Light.cs b/vrchat.jordo.easyquestswitch/Runtime/EQS_Types/Type_Light.cs index c570bb6..c14abe7 100644 --- a/vrchat.jordo.easyquestswitch/Runtime/EQS_Types/Type_Light.cs +++ b/vrchat.jordo.easyquestswitch/Runtime/EQS_Types/Type_Light.cs @@ -34,6 +34,17 @@ public override void Setup(Object type) RenderMode.Setup(component.renderMode); } + public override void Setup(Object type, int currentVersion) + { + Light component = (Light)type; + if (currentVersion == 0) // 0 -> 131 upgrade + { + LightType.Setup(component.type); + Range.Setup(component.range); + RenderMode.Setup(component.renderMode); + } + } + public override void Process(Object type, BuildTarget buildTarget) { base.Process(type, buildTarget); diff --git a/vrchat.jordo.easyquestswitch/Runtime/EQS_Types/Type_Material.cs b/vrchat.jordo.easyquestswitch/Runtime/EQS_Types/Type_Material.cs index 45de15f..1b584cf 100644 --- a/vrchat.jordo.easyquestswitch/Runtime/EQS_Types/Type_Material.cs +++ b/vrchat.jordo.easyquestswitch/Runtime/EQS_Types/Type_Material.cs @@ -26,6 +26,16 @@ public override void Setup(Object type) GPUInstancing.Setup(material.enableInstancing); } + public override void Setup(Object type, int currentVersion) + { + Material material = (Material)type; + if (currentVersion == 0) // 0 -> 131 upgrade + { + MainColor.Setup(material.color); + GPUInstancing.Setup(material.enableInstancing); + } + } + public override void Process(Object type, BuildTarget buildTarget) { Material material = (Material)type; diff --git a/vrchat.jordo.easyquestswitch/package.json b/vrchat.jordo.easyquestswitch/package.json index 4a11dbb..47e1fb3 100644 --- a/vrchat.jordo.easyquestswitch/package.json +++ b/vrchat.jordo.easyquestswitch/package.json @@ -1,7 +1,7 @@ { "name": "vrchat.jordo.easyquestswitch", "displayName": "EasyQuestSwitch", - "version": "1.3.0", + "version": "1.3.1", "unity" : "2019.4", "description": "EasyQuestSwitch is a Unity editor tool developed for VRChat world creators, it can automate changes to components within a scene as soon as the build platform is changed from PC to Android (for Oculus Quest) or vice versa.", "author" : {