Forum rules - please read before posting.

Issue with bone 2D animations sprites

Hello! I've started recently doing my first game. I have already done the assets and I use unity sprite editor for doing 2D animations. I have see that all animations have to be in the same animation controller so I merge the 4 assets in one file and just hide the other ones in the animations.

Animations works fine, but when i want to attach the animation controller to my character ( with front_idle, left_idle, front_walk, etc...) but when I click to play game, animations are not loaded. Some advice in here?

https://drive.google.com/open?id=12IE7GI08gJbhdt0W5rGcBDjXhcgUN3IP

Comments

  • edited January 2020

    Welcome to the community, @CutyDina.

    The names of your animations need to following a naming convention whereby the direction is added to the e.g. "Idle name" in the form e.g. "_R" for right-facing.

    This is true regardless of how the character is animated - i.e. sprite-flipping, or bone-based.

    In your Player Inspector, you've set your "Idle name" is set to "rikaidle" and enabled Down and Left directions. AC will then require your idle animations (placed in the base layer of your Animator) to be named "rikaidle_D" and "rikaidle_L".

    You can open up the List expected animations? foldout, just beneath, for a full list of all animations. See the Manual's "Characer animation (Sprites Unity)" chapter for more on this topic.

    The Console will also tell you, while the game runs, of any animations it wants to play but cannot find. Your second screenshot shows that it's looking for "rikawalk_L", but that it can't be found.

    Check the names of your animations in your Animator Controller. If in doubt, you can post a screenshot showing this Controller's contents.

    A tutorial on getting started with 2D games, including sprite-based characters, can be found here.

  • Hello Chris. Thanks for answering. Thats the strange part. I have all the animations named correctly. and if I tested in the scene they look ok. But the issue occurs when I play the game and I don't know why animations are not found.
    https://drive.google.com/file/d/1jt-KTXtxUuBIyLUOaA18qIhHghAbYMro/view

  • Anyway, here console errors if that helps a little to understand what is happening:

    https://drive.google.com/file/d/1fmQjcCI6ANyJw0PvVk8AfkGj1_sk1Kaw/view?usp=sharing

  • Yes, it does look like the names match up - though I'd recommend copy/pasting the name in the Console into the Animator Controller just to be sure.

    Just about, however, is a warning about the Animator not playing an Animator Controller - which may be the root issue.

    This error is coming from Unity - searching this on the Unity forums brings up a fair few threads about it. It typically shows if the Animator - or GameObject it's on - is disabled. Might this be the case?

    If you can create a .unitypackage file of the Player prefab, animation controller, animation clip assets, and sprites, you can PM it to me and I'll take a look.

  • thankyou! already send the files.

  • I get similar warnings when running the game, but that is because the Controller is not assigned, and the animation names are set to their defaults (i.e. "idle", "walk"). Setting these to the values in your screenshots removes the warnings.

    However, the larger issue is that you have each of your "directional" sprite chains as direct roots of the Player object. These should all be children of a "sprite child", which can be an empty GameObject but is assigned in the Player's Inspector in the field by the same name. The Animator can be placed on here instead, to avoid having to re-do all the animations.

  • Yes, I have done that and finally worked! Thanks!

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.