以下の内容はhttps://baba-s.hatenablog.com/entry/2020/03/03/090000より取得しました。


【Unity】AnimationCurve の設定範囲を 0 から 1 に制限できるエディタ拡張

ソースコード

using UnityEngine;
 
public sealed class Curve01Attribute : PropertyAttribute
{
}
using UnityEditor;
using UnityEngine;

[CustomPropertyDrawer( typeof( Curve01Attribute ) )]
public sealed class Curve01Drawer : PropertyDrawer
{
    public override void OnGUI
    (
        Rect               position,
        SerializedProperty property,
        GUIContent         label
    )
    {
        if ( property.propertyType != SerializedPropertyType.AnimationCurve ) return;

        var ranges = new Rect( 0, 0, 1, 1 );

        EditorGUI.CurveField
        (
         position: position,
         property: property,
         color: Color.cyan,
         ranges: ranges
        );
    }
}

参考サイト様




以上の内容はhttps://baba-s.hatenablog.com/entry/2020/03/03/090000より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14