Search Unity

Can someone help me?

Discussion in 'Animation' started by Future_Modder, Jan 27, 2020.

  1. Future_Modder

    Future_Modder

    Joined:
    Jan 27, 2020
    Posts:
    3
    I'm fairly new and i have a sword with a ring floating around it i want it to float up and down and on a event it calls another animation that spins it around(i can call it with a script attached to a game object) but this is out of my range of ability. Can someone at least help me do it? Also im using unity 2018.1.6f1
     
  2. Inxentas

    Inxentas

    Joined:
    Jan 15, 2020
    Posts:
    278
    Is your sword a seperate Prefab? Then this might be a simple solution. Mind you, I am also new to Unity so this is probably not the best way to do such things, but one that works for us newbies. Mind that I'd advise you to keep working on that skillset, even a crappy solution will do over none IMO.

    Create the GameObject you want to use as the effect and make it a child of the sword object. Hide it by default, either through code or the Inspector. Now you can either do this through Animations or code... if you want to use animations you'll have to research how Animations and AnimationControllers work. These are relatively simple things to learn so I recommend you give that some time. Now there's a simple trick with these animations: you can call a function from any frame within you Animation using Animation Events.

    Right-clicking on the grey bar above an Animation's timeline will let you add one. It should speak for itself really, but I found it a powerful tool to line up animations with code. If you can be more specific about how your sword currently operates we might be able to help you further.