For some reason I keep getting the Null Reference error for this line of code: Code (CSharp): voidOnTriggerEnter(Colliderother) { if (animation ["attck1"].enabled == true) { SendMessage ("Damage", 1.0f, SendMessageOptions.DontRequireReceiver); } }
Copy pasting must have messed up with spaces. attck is the name of the animation. Thanks for the replies, I don't understand what you mean by arrays take integers not strings.
animation isn't an array. The indexer operator looks up the AnimationClip with that name. http://docs.unity3d.com/ScriptReference/Animation.Index_operator.html
"animation" might be null There might be no animation clip named "attck1" in the animation component Doing some logging/debugging of those things should tell you what's going on.