hi, im trying to make an animation for an axe to chop down trees. ive got the .anim file and the controller file but dont know how to place them onto an object for a script to read. can anyone help me on creating the object? Also will i need to edit this script for it to play the animation if im to run it from a different piece of code? Code (CSharp): using System.Collections; using System.Collections.Generic; using UnityEngine; public class Axe : MonoBehaviour { public Animation anim; public void Swing() { anim.Play(); } }
You should probably start with some basic Unity tutorials like Survival Shooter. The tutorial covers how to do basic stuff like you're asking about.
this is using unity 4, so it changes the code a little. plus they changed the code alot for what i need because theyre animating the movement ect.
The reason I suggested the tutorial is because the principles are the same and it doesn't sound like you are aware of what role Animations and Animator Controllers play in the character structure. Rather than explain how all of that works, it's easier for you to just review the basic tutorials about animation to get a firm understanding of how to do what you want.