Skip to content

Commit

Permalink
Added obsolete markers to old attributes
Browse files Browse the repository at this point in the history
- Migrated old attributes to Legacy
  • Loading branch information
orels1 committed Sep 6, 2020
1 parent 1408137 commit 8761852
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Attributes/UTAttributes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -377,23 +377,27 @@ public PopupAttribute(string methodName) {
this.methodName = methodName;
}

[Obsolete("Deprecated since UdonToolkit 0.4.0, use the other Popup signatures")]
public PopupAttribute(PopupSource sourceType, string methodName) {
this.sourceType = sourceType;
this.methodName = methodName;
}

[Obsolete("Deprecated since UdonToolkit 0.4.0, use the other Popup signatures")]
public PopupAttribute(PopupSource sourceType, string methodName, ShaderPropType shaderPropType) {
this.sourceType = sourceType;
this.methodName = methodName;
this.shaderPropType = shaderPropType;
}

[Obsolete("Deprecated since UdonToolkit 0.4.0, use the other Popup signatures")]
public PopupAttribute(PopupSource sourceType, string methodName, bool hideLabel) {
this.sourceType = sourceType;
this.methodName = methodName;
this.hideLabel = hideLabel;
}

[Obsolete("Deprecated since UdonToolkit 0.4.0, use the other Popup signatures")]
public PopupAttribute(PopupSource sourceType, string methodName, ShaderPropType shaderPropType, bool hideLabel) {
this.sourceType = sourceType;
this.methodName = methodName;
Expand Down
29 changes: 29 additions & 0 deletions Legacy/UTAttributes_Legacy.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using System;
using System.Linq;
using UdonSharp;
using UnityEngine;
using VRC.Udon.Editor.ProgramSources;

namespace UdonToolkit.Legacy {
[Obsolete("This attribute is not needed anymore as it is only used with now deprecated Controllers. Learn more: https://l.vrchat.sh/utV4Migrate")]
[AttributeUsage(AttributeTargets.Class)]
public class ControlledBehaviourAttribute : Attribute {
public UdonProgramAsset uB;

public ControlledBehaviourAttribute(Type T) {
var assets = Resources.FindObjectsOfTypeAll(typeof(UdonSharpProgramAsset))
.Select(a => a as UdonSharpProgramAsset).ToArray();
foreach (var asset in assets) {
try {
if (asset != null && asset.sourceCsScript.GetClass() == T) {
uB = asset;
}
}
catch {
// ignored
}
}
}
}

}
3 changes: 3 additions & 0 deletions Legacy/UTAttributes_Legacy.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8761852

Please sign in to comment.