Page 2 of 4

Re: Tweening characters as they appear in the scene

Posted: Thu May 23, 2019 9:47 am
by Tony Li
Hi,

On Spine's forum, you got a reply that explains how to use a Mecanim animator controller if you want to do that. It's probably the easiest way since you can use the existing dialogue UI functionality like AnimatorPlay() as described in the video.

For the third subtitle panel, yes, change Visibility to Until Superceded. The third subtitle panel will play its Unfocus and Hide animations when it's another character's turn to talk. When the Hide animation is done, it will deactivate its panel.

Re: Tweening characters as they appear in the scene

Posted: Thu May 23, 2019 3:56 pm
by AoF
Great! Thanks a lot. One thing I still wasn't sure of is how do I animate the character sliding in from the right to the left? Should that be done as its own Spine animation or is there a Dialogue call that can do it?

Re: Tweening characters as they appear in the scene

Posted: Thu May 23, 2019 4:06 pm
by Tony Li
Here are two ways.

1. You could make a subclass of StandardUISubtitlePanel that adds the Spine character to the subtitle panel, perhaps as a child of the Portrait Image, which will now just be blank since you'll be showing a Spine character instead. Then you can use animation like the way it's set up in the example scene I posted a few replies up.

2. Or you could do it as a separate animation, either as a Spine-generated Mecanim animation or a plain old in-Unity animation that slides its transform in. You can use the AnimatorPlay() sequencer command to play the animation.

Re: Tweening characters as they appear in the scene

Posted: Thu May 23, 2019 6:17 pm
by AoF
Great, thanks!

Re: Tweening characters as they appear in the scene

Posted: Fri May 24, 2019 4:28 pm
by AoF
Unfortunately, I couldn't get this to work. I'm trying to go the route shown in the video. I made a prefab variant of the VN Dialogue UI that comes with the library and checked "Use animated portraits." Otherwise, it's unmodified.

Here's my scene:

Image

The inspector shows the mechanim object that's created by Spine (Eva). I'm thinking it's worth showing this, because maybe the object is created in an unexpected way that won't work with the Dialogue System? Of note is how the Spine object doesn't have a Sprite Renderer. Does that matter?

I'm intentionally putting Eva (the spine object) outside of the camera view because my understanding is it shouldn't be used directly. Instead, its controller should be given to a Dialogue Actor script, and that will be used for rendering?

Actually, maybe I should pause for a second and you can clarify things for me. I think I understand the theory, but I'm not sure:

I think the way this is supposed to work is the Dialogue UI is generic and I tell it where portraits will go. If I check the "Use animated portraits," box, I think that means it'll use an animation controller that's specified on the PC/NPC's Dialogue Actor script at runtime. I'm not really sure what it would use if I didn't check that box. I'm guessing it would use the "Portrait" in the Dialogue Actor script instead?

Anyway, when I hit the play button, it looks like this:

Image

I expected to see Eva there instead of a white box.

When I inspect the subtitle panel at play time, it looks like this:

Image

I would have expected the highlighted part to change to the Spine animation controller. I'm not sure why it didn't. It makes me think I'm misunderstanding something about the theory. I looked at all the other subtitle panels and they all are using that highlighted controller.

Here's how I've defined the NPC:

Image

Let me know if there's anything else you want to see.

Re: Tweening characters as they appear in the scene

Posted: Fri May 24, 2019 5:17 pm
by Tony Li
Animated portraits typically use UI Images (see Animated Portraits).

It shouldn't be too complicated to write a small subclass of StandardUISubtitlePanel to use a Spine MeshRenderer. I'll look into it tomorrow morning and post an example.

However, now that I think about it, you might be able to do without a subclass. Make the portrait image invisible. In Eva_Controller, set up an animation that tweens Eva into view. In the dialogue entry that corresponds to when you want her to appear, in the Sequence field use the AnimatorPlay() sequencer command to play that animation.

Re: Tweening characters as they appear in the scene

Posted: Fri May 24, 2019 5:20 pm
by AoF
Thank you! In parallel, I'll try to figure that out on my own. I just realized your previous reply was telling me to do this. I'm sorry for eating up all your time, but maybe after this you can check a box on your feature matrix that says, "Spine integration." Hope I don't sound like an ass for saying that. I genuinely think that would be a cool feature.

Re: Tweening characters as they appear in the scene

Posted: Fri May 24, 2019 5:27 pm
by AoF
Tony Li wrote: Fri May 24, 2019 5:17 pm However, now that I think about it, you might be able to do without a subclass. Make the portrait image invisible. In Eva_Controller, set up an animation that tweens Eva into view. In the dialogue entry that corresponds to when you want her to appear, in the Sequence field use the AnimatorPlay() sequencer command to play that animation.
Correct me if I'm wrong, but I think this was the second suggestion out of two that you were giving above. I really don't understand all the ramifications of choice one vs two, but choice one seems more convenient overall because if I go with the AnimatorPlay(), won't I have to remember to use it for every character in the dialogue or else the portrait will be missing and it'll be a faceless person talking? It seems harder to make that mistake with choice one, because the Dialogue Actor script can be reused over and over again for each conversation.

Re: Tweening characters as they appear in the scene

Posted: Fri May 24, 2019 6:08 pm
by Tony Li
You're absolutely correct. I'm looking forward to adding Spine support without having to manually remember AnimatorPlay() for every character. I'll try to have an example for you tomorrow.

Re: Tweening characters as they appear in the scene

Posted: Sat May 25, 2019 9:56 pm
by AoF
Hiya! Just wondering if you were able to figure this out yet? Thanks for all the help!