PlayCanvasチートシート Unityと比べてみよう エディタ拡張編 その1
PlayCanvasのエディタ拡張的な要素である「スクリプト属性」について
あんまり日本語の解説がなかったのでUnityと比較してまとめてみる。
参考
色
Unity
public Color color;
PlayCanvas
Attribute.attributes.add("color", { type: "rgba" });
こんな感じになる
スライダー
Unity
[Range(100f, 250f)] public float height = 175.8f;
PlayCanvas
Test.attributes.add("height", { type: "number", placeholder: "cm", default: 175.8, min: 100, max: 250 });
こんな感じになる
配列
Unity
public string[] characters;
PlayCanvas
Test.attributes.add("characters", { type: "string", array: true, });
こんな感じになる
ちなみに重複は許されない(gifだと"太郎"のところ)
列挙
Unity
public enum Value { valueOne = 1, valueTwo = 2, valueThree = 3 } public Value value;
PlayCanvas
Test.attributes.add("value", { type: "number", enum: [ {"valueOne": 1}, {"valueTwo": 2}, {"valueThree": 3} ] });
こんな感じになる
曲線
Unity
public AnimationCurve wave;
PlayCanvas
Attribute.attributes.add("wave", { type: "curve" });
こんな感じになる
備考
Unityにはない使い方ができるものもあるので、 それはまた今度