So I'm doing 2D, no character movement (think VN/hidden object).
I have everything configured correctly according to the documentation and even the 2D head turning example, but no matter what I do, the lipsync animations always affect the main body sprite, rather than the head child.
The animations are playing correctly otherwise, regarding the layers and all that. The only issue is it seems lipsync is just not detecting the head.
Here's a link to the npc root, body, and animator setup. The head just has the sprite renderer on it. https://imgur.com/a/nX3bI45
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
Welcome to the community, @araphre. What are your AC/Unity versions?
I don't see anything amiss in the screenshots - are the animations in the Head layer separate assets to those in the Body layer that only animate the head?
You mention lipsyncing - are you referring to the dedicated Lipsync tools in the Speech Manager, or just playing the regular talk animation in a simple loop?
I appreciate the quick response!
Both are latest available versions- unity is 6-45f1, AC 1.83.0.
The animation clips are separate in the controller and as assets. The head talking clip/layer only contains the part of the character with the mouth moving, and the body layer contains the rest.
The lipsync is the dedicated tools from AC, generated from speech text and applied to portrait and game object. This also works as expected- if it was applying the new sprite frame to the head sprite rather than the body sprite.
While testing, I've watched in the inspector and indeed that's exactly what's happening- when I play speech on this character, the correct animation plays, but it's applying to the root/body... which overrides the body's sprite, making it disappear during the lipsync.
I know the body's animation is working fine on its own too as I'm also playing a blinking anim immediately after, and it plays correctly. The idea is for the blinking to be independent of the lipsync.
For what it's worth, I copied the Brain prefab from the 2D head example (from downloads) and lightly edited it, simply replacing the brain assets with my own, and it exhibited the exact same behavior.
Is this to say that the default talking animation plays correctly if you disable lipsyncing?
With From Speech Text mode, and Sprites Unity animation, the animation should work by playing the provided Talk animation using the current lipsync frame to set the normalized time. I'm not quite following because it shouldn't affect what animation gets played - so if the body layer is playing the head animation, I'm not clear where that would be coming from if it weren't already in the Base layer.
When you say "the correct animation plays", do you mean that it's playing a unique animation - or simply playing the standard talk animation using the normalized time method as above?
If you pause the game while the issue occurs, does looking through the Animator layers reveal what's going on?
Sorry for being confusing- I'm meaning to say that it's playing the correct animation at the correct time, it's simply targeting the wrong sprite renderer- it's ignoring the separate head game object entirely and replacing the body sprite instead, as if 'separate head' wasn't checked.
Disabling lipsync behaves the exact same way. I recreated the character and the animation controller from scratch and got the same results.
I can make a video of my entire process when I get home from work later today. Once again, I super appreciate the help.
If that's the case, I'd recommend double-checking the setup of the animations themselves, to make sure you don't have a "head" animation that affects the body.
AC won't be in control of what object an animation affects - it will only control playback of what animations are present in the Controller.
If you'd like me to take a look, probably best to PM me your character prefab and associated asset files (animations, controller etc).
So if AC doesn't control what an animator affects, how does the animator know to change the sprite of the head object rather than the body object? I feel like there's a step I'm missing somewhere.
The documentation and demo shows we need a head object as a child of the body, and that object has the head sprite on it- whereas the body has the headless sprite, so that the two can be animated independently. But regardless of the layers, the animator is only changing the sprite of the game object that it is on. So for example, when playing a speech on the demo Brain character, the head disappears and the body becomes the head and talks (as in, it's playing the animation correctly, but on the wrong object). Changing the layers to additive also does not solve the issue.
Either way, I'll be DMing over my assets right after posting. Note that my character's 'head' is just the lower half of the sprite where the mouth is located. The 'body' is the upper half with the eyes- because ideally, I would be able to have the eyes blinking at the same time independently of the mouth lipsyncing. No other animation is required as these will be entirely static.
Thanks for the files - but I'd need them either as a .unitypackage file export, or for them to also include the associated .meta files.
From your description, above, however, I think I'm understanding the issue:
Which object an animation affects is embedded within the animation itself. An AnimationClip asset can control the properties of not just its associated GameObject - but also any child objects underneath it in the Hierarchy.
You'll want to attach your Animator to the body, which should be a parent of the head. You can then animate both objects within your animations - the "body" idle animation animating the body object, the "head" animations affecting the head object.
Animator layers don't control which object is affected by an animation. They simply allow for multiple animations to play at the same time - in this case, the head and the body.
As an example, using AC's "2D head animation" package, have a look at the Idle_D animation inside the Shared/Animations folder in the Animation window, and compare it with the Head_D animation inside /SpritesUnity/HeadAnimations.
Both are using the Body object as the "root" - i.e. the one with the Animator on it. Idle_D, which animates the Body, simply has a "Sprite" animation channel - indicating that it is animating the Sprite on this same object.
Head_D, however, which animated the Head child object, has a "Head : Sprite" animation channel - the colon indicating that it's animating the "Sprite" property of the "Head" child object.
These aspects of the workflow aren't specific to AC - but Unity's animation system in general.
My god that was exactly the issue. I did not understand the animation window, and how you had to have the actual objects selected to edit the properties of the animation clip- and how that would determine how/where it would play. I didn't see these properties in the example because you can basically see and do nothing in the animation window without a game object selected.
Thank you so much for your continued responses and patience working with me. We had to abruptly switch to Unity and my skills with it are over a decade rusty, and already your toolkit and support is paying off.