0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

はじめてのアドベントカレンダーAdvent Calendar 2023

Day 14

Unityのinspectorでcurve入力

Last updated at Posted at 2023-12-15

Unityでゲームコントローラのアナログ値に変化を加えたいメモ

AnimationCurveの利用

エディター機能の利用

using UnityEditor;

public AnimationCurve animationCurve;

配列で保持

いろいろ種類を持ちたいので配列で保持

[NonReorderable] public AnimationCurve[] animationCurve;
[SerializeField, Range(0, 10)] int animationCurveIndex = 0;

こんな感じで複数を保持

image.png

取り出し方

Indexを入力できるようにしてcurveの値を取得

public float GetValue(float val)
{
  return animationCurve[animationCurveIndex].Evaluate(Math.Abs(val));
}

参考URL

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?