- Home /
Question by
QueenMaebee · Mar 17 at 10:23 AM ·
c#animationclipanimationcurve
Disable Game Object in scripted animationclip not working,How to generate 2 frame bool animations from c#
I've figured out how to make animations using scripts and I've researched making the script toggle the game Object yet all of the "solutions" don't work. This is my code:
AnimationClip clip2 = new AnimationClip();
AnimationCurve curve2;
EditorCurveBinding curveBinding2 = new EditorCurveBinding();
curveBinding2.type = typeof(GameObject);
curveBinding2.path = "";
Keyframe[] keys2;
keys2 = new Keyframe[2];
keys2[0] = new Keyframe(0f, 0);
keys2[1] = new Keyframe(0.0169f, 0);
curve2 = new AnimationCurve(keys2);
clip2.SetCurve(toggleObject.name, typeof(GameObject), "m_IsActive", curve2);
AnimationClip asset2 = (AnimationClip)AssetDatabase.LoadAssetAtPath("Assets/ToggleAnims/" + toggleObject.name + " Off.anim", typeof(AnimationClip));
if (asset2 == null)
{
AssetDatabase.CreateAsset(clip2, "Assets/ToggleAnims/" + toggleObject.name + " Off.anim");
}
Comment
Your answer

Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Mecanim : Get animation clip curve 0 Answers
How to change AnimationClip KeyFrame values at runtime 1 Answer