Created
July 28, 2020 07:04
-
-
Save gszauer/e690d3c083dd9964a9081f0eba18709a to your computer and use it in GitHub Desktop.
Explore Unity Curves
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using UnityEngine; | |
using UnityEditor; | |
public class CurveExplorer : MonoBehaviour | |
{ | |
public AnimationCurve curve; | |
[MenuItem("CONTEXT/CurveExplorer/Copy Data")] | |
static void CopyCurveInfo(MenuCommand command) | |
{ | |
CurveExplorer explorer = (CurveExplorer)command.context; | |
if (explorer == null) | |
{ | |
return; | |
} | |
string result = ""; | |
Keyframe[] frames = explorer.curve.keys; | |
for (int frame = 0; frame < frames.Length; ++frame) | |
{ | |
Keyframe key = frames[frame]; | |
result += "Frame " + frame + "\n\t"; | |
result += "time: " + key.time + "\n\t"; | |
result += "in: " + key.inTangent + "\n\t"; | |
result += "value: " + key.value + "\n\t"; | |
result += "out: " + key.outTangent + "\n\n"; | |
} | |
EditorGUIUtility.systemCopyBuffer = result; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment