Skip to content

Commit

Permalink
Merge pull request #26 from vrchat-community/1.3.1
Browse files Browse the repository at this point in the history
1.3.1 - Added version checking & migration setup call
  • Loading branch information
Jordo committed Feb 23, 2024
2 parents 897dfd3 + 90872f1 commit faec590
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 5 deletions.
2 changes: 1 addition & 1 deletion vrchat.jordo.easyquestswitch/Editor/EQS_Window.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
26 changes: 23 additions & 3 deletions vrchat.jordo.easyquestswitch/Runtime/EQS_Data.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ public class Data
}

public List<Data> Objects;
public int version = 0;
private const int currentVersion = 131;

public void ValidateData(int index)
{
Expand Down Expand Up @@ -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());
Expand All @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions vrchat.jordo.easyquestswitch/Runtime/EQS_Types/Type_Base.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down
11 changes: 11 additions & 0 deletions vrchat.jordo.easyquestswitch/Runtime/EQS_Types/Type_Light.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
10 changes: 10 additions & 0 deletions vrchat.jordo.easyquestswitch/Runtime/EQS_Types/Type_Material.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion vrchat.jordo.easyquestswitch/package.json
Original file line number Diff line number Diff line change
@@ -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" : {
Expand Down

0 comments on commit faec590

Please sign in to comment.