Hello, I have a question about Focus/Unfocus animation.
I set up a Dialogue Panel with two Subtitle Panels (Subtitle Panel 0 and Subtitle Panel 1);
both panels have child objects like Portrait Name and Portrait Image (0 and 1 respectively);
and those Portrait Images have child objects: Portrait Image Eyes and Portrait Image Mouth.
The animated portraits work as expected. But when I want to play Focus/Unfocus animation, it doesn't affect the Portrait images.
Both Subtitle Panel 0 and 1 have Animator component with Canvas Group Animator Controller assigned.
The Focus animation changes the Color property of the Subtitle Panel from 50%gray to white.
(I changed it from affecting the alpha of a Canvas Group).
When I try to add a Color property (Image component) in Focus animation for the Portrait Image (ie the child object of the Subtitle Panel) it adds it, but I cant change it due to the fact that Portrait image has it's own Animator Controller assigned (that animates the character portrait and its parts). So when I click on it, it shows me the animations of another Animator Controller.
I was able to animate Portrait Names on Focus/Unfocus, but can't do the same with Portrait Images.
Interestingly enough, if I animate the Alpha of the Canvas Group component on a Subtitle Panel, it seems to work well enough (but I don't want a semi-transparent portrait, I want it slightly darkened).
Please, can you help understand why this doesn't work. I am a newbie still, so maybe I'm missing something.
I will add screenshots in attachments.
Focus/Unfocus animation doesn't work on portraits with separately animated parts
Focus/Unfocus animation doesn't work on portraits with separately animated parts
- Attachments
-
- 6CHfV8GT70.png (431.72 KiB) Viewed 830 times
-
- fKeYiO4cbl.png (430.72 KiB) Viewed 830 times
Re: Focus/Unfocus animation doesn't work on portraits with separately animated parts
Hi,
You can still configure Subtitle Panel 0's animator to animate Portrait Image 0's Image color, even if Portrait Image 0's animator controls the sprites that are playing on the Image. Here's an updated example:
DS_AnimatedPortraitExample_2020-09-03.unitypackage
I only set up the focus animation for Subtitle Panel 0.
You can still configure Subtitle Panel 0's animator to animate Portrait Image 0's Image color, even if Portrait Image 0's animator controls the sprites that are playing on the Image. Here's an updated example:
DS_AnimatedPortraitExample_2020-09-03.unitypackage
I only set up the focus animation for Subtitle Panel 0.
Re: Focus/Unfocus animation doesn't work on portraits with separately animated parts
Thanks, I checked it and it looks like the Focus animation only works on the background of the portrait. And the Portrait Image itself is not changing its color (so it's the same situation I have right now, only I don't have a background for my portraits).
Re: Focus/Unfocus animation doesn't work on portraits with separately animated parts
I'll update the example later today with an animation that also applies to the additional images.
Re: Focus/Unfocus animation doesn't work on portraits with separately animated parts
This updated example tints the color of the main portrait image and the "eyes" child image of NPC Subtitle Panel 0:
DS_AnimatedPortraitExample_2020-09-04.unitypackage
Examine the Focus animation for that subtitle panel, in particular how it sets the colors of the main image and eyes image. It also has keyframes to change the canvas group's alpha, but I removed the canvas group from the subtitle panel since you said you didn't want fading, so those keyframes will be ignored.
DS_AnimatedPortraitExample_2020-09-04.unitypackage
Examine the Focus animation for that subtitle panel, in particular how it sets the colors of the main image and eyes image. It also has keyframes to change the canvas group's alpha, but I removed the canvas group from the subtitle panel since you said you didn't want fading, so those keyframes will be ignored.
Re: Focus/Unfocus animation doesn't work on portraits with separately animated parts
Thanks so much for your reply! I was able to make Focus animation work in my game, thanks to some valuable insight from your example.
But I'm not sure what goes wrong every time, this is in your example (I didn't change there anything):
So only the eyes are tinted at all times.
The portrait itself stays the same (only background changes color).
Just letting you know about it. My problem is fixed thanks to you, so there's no need to adjust the example just for me.
I use Unity 2020.1.2f1
But I'm not sure what goes wrong every time, this is in your example (I didn't change there anything):
So only the eyes are tinted at all times.
The portrait itself stays the same (only background changes color).
Just letting you know about it. My problem is fixed thanks to you, so there's no need to adjust the example just for me.
I use Unity 2020.1.2f1
Re: Focus/Unfocus animation doesn't work on portraits with separately animated parts
Hmm, I must have missed an animation file or something when I exported it. Anyway, glad you got things working in your project!
Re: Focus/Unfocus animation doesn't work on portraits with separately animated parts
Hi Tony.Thank you make the example let me modified to make the different animation's purpose .
I just have a little problem want to ask is when you call the function "AnimatorPlay(Talk, Portrait Image 0);" in a node sequence,the name "Portrait Image 0" really should not be all the same name in the hierarchy?(means "Portrait Image 0" "Portrait Image 1" and "Portrait Image 2" all change the name "Portrait Image")I tried to do this thing,but it would let the function not work when I call the second Portrait(means after I changed the name,I use "AnimatorPlay(Talk, Portrait Image);" to let the second portrait talk,it not work,but the first portrait worked).
I must name the different name that could let the function work.I just want to know is there some way could let me call the same name.(Because I think it should be worked,although maybe you have your considerations )
Just because if the talk function have different functions would let the scrip writer confuse..I am trying to help him lessen the burden.
I just have a little problem want to ask is when you call the function "AnimatorPlay(Talk, Portrait Image 0);" in a node sequence,the name "Portrait Image 0" really should not be all the same name in the hierarchy?(means "Portrait Image 0" "Portrait Image 1" and "Portrait Image 2" all change the name "Portrait Image")I tried to do this thing,but it would let the function not work when I call the second Portrait(means after I changed the name,I use "AnimatorPlay(Talk, Portrait Image);" to let the second portrait talk,it not work,but the first portrait worked).
I must name the different name that could let the function work.I just want to know is there some way could let me call the same name.(Because I think it should be worked,although maybe you have your considerations )
Just because if the talk function have different functions would let the scrip writer confuse..I am trying to help him lessen the burden.
Re: Focus/Unfocus animation doesn't work on portraits with separately animated parts
The AnimatorPlay() sequencer command requires a unique GameObject name. This is why you need to specify Portrait Image 0, Portrait Image 1, etc.
You could write a custom sequencer command to play an animation on the current speaker's portrait image.
I plan to add a new sequencer command to do that in version 2.3.0. Version 2.2.10 is releasing today, and version 2.3.0 will release in about 2 weeks.
You could write a custom sequencer command to play an animation on the current speaker's portrait image.
I plan to add a new sequencer command to do that in version 2.3.0. Version 2.2.10 is releasing today, and version 2.3.0 will release in about 2 weeks.