Page 1 of 2
How do I stop the animation portraid
Posted: Tue Aug 23, 2022 4:03 pm
by Dralks
Hi Tony, I'm currently using animated portraits in my project and it works great, but some conversations will have an animated portrait and some will use the default portrait, in the sequence for the animated ones I'm using:
Code: Select all
AnimatorPlay(Talk, Portrait Image 0);
required AnimatorPlay(Talk, Portrait Image 0)@{{end}}
but not quite sure how to go back to using the default database portrait when needed inside the same dialogue, the animation continues unless a new one starts, I know that I can just set up animations with 1 image, but I suspect that there is something cleaner.
Also how come we need to use AnimatorPlay twice, notice that it doesn't work if you just use one of the parts
For example:
Hi (animated) > I'm blabla (animated) > nice to meet you (not animated, default portrait) > you are? (not animated, default portrait) > ok! (animated)
Re: How do I stop the animation portraid
Posted: Tue Aug 23, 2022 5:09 pm
by Tony Li
Hi,
Did you mean "Idle" or something like that?
Code: Select all
AnimatorPlay(Talk, Portrait Image 0);
required AnimatorPlay(Idle, Portrait Image 0)@{{end}}
BTW, you can use the special keywords 'speakerportrait' and 'listenerportrait' instead of specifying the portrait image GameObject by name:
Code: Select all
AnimatorPlay(Talk, speakerportrait);
required AnimatorPlay(Idle, speakerportrait)@{{end}}
Since you're using animated portraits, for consistency use an animation with 1 image for still portraits, or use a different subtitle panel.
Re: How do I stop the animation portraid
Posted: Wed Aug 24, 2022 4:49 am
by Dralks
no, I meant using just the portrait that we have in the database instead of keep using the animator, but yesterday we decided to use the animator for 100% of our portraits so this is not an issue anymore, if they have animation good, if not we just show a static image as animation, so now I can automatically add which portrait to use from the excel file.
I updated the import from Excel script A LOT and now 100% of our dialogs and UI texts are being updated directly from the excel file, including the table text file and scriptable objects so all items names and descriptions are being added automatically on import, I really like how easy you made that all to work with I could build the whole thing by just navigating around and checking the public variables
Re: How do I stop the animation portraid
Posted: Wed Aug 24, 2022 8:15 am
by Tony Li
Thanks!
Re: How do I stop the animation portraid
Posted: Wed Aug 24, 2022 3:30 pm
by Dralks
Hey Tony,
one issue that is happening now, as mentioned above we have no portrait because we are planning to get everything from the Animator, but the portrait image is not being displayed in the UI because there is no portrait assigned to the actor in the database, so the animation never has a chance to run as the portrait image is disabled.
is there a way to make sure that an image will be displayed if the current actor has an animation sequence to run in this conversation? I tried to trick it into thinking that there is a portrait by doing this when creating the actor,
Code: Select all
actor = template.CreateActor(template.GetNextActorID(prefs.database), actorName, false);
actor.portrait = new Texture2D(1,1);
actor.spritePortrait = Sprite.Create(actor.portrait,new Rect(), Vector2.zero);
prefs.database.actors.Add(actor);
but portrait is still null when checked:
Code: Select all
if (speakerInfo == null) return null;
if (formattedText == null) return speakerInfo.portrait;
if (formattedText.pic != FormattedText.NoPicOverride) return speakerInfo.GetPicOverride(formattedText.pic);
if (formattedText.picActor != FormattedText.NoPicOverride) return speakerInfo.GetPicOverride(formattedText.picActor);
if ((formattedText.picConversant != FormattedText.NoPicOverride) && (listenerInfo != null)) return listenerInfo.GetPicOverride(formattedText.picConversant);
return speakerInfo.portrait;
Re: How do I stop the animation portraid
Posted: Wed Aug 24, 2022 4:13 pm
by Dralks
solved, found the point that makes it null and updated it to see if there is an animator first, let me know if there is an easier way
Code: Select all
else if(animator.runtimeAnimatorController == null)
{
StartCoroutine(SetAnimatorAtEndOfFrame(null));
}
Re: How do I stop the animation portraid
Posted: Wed Aug 24, 2022 4:29 pm
by Tony Li
Hi,
Just assign one of the portrait sprites from the animation to the actor's Portrait Sprite in the Dialogue Editor.
Re: How do I stop the animation portraid
Posted: Wed Aug 24, 2022 5:24 pm
by Dralks
everything is working well now, just 1 little detail, and I do apologise for asking so much, the animation is changing too fast to the animation of the next conversation, so the animation changes to the next one when the current dialog is closing and the player can see the swap before loading the next conversation, I tried to avoid it by adding a delay to the sequence to no success, how can I say "wait half a second before loading this animation" or before loading the next animation, whatever is easier.
Code: Select all
AnimatorPlay(Angry, Portrait Image); required AnimatorPlay(Angry, Portrait Image); delay(50)@{{end}}
also tried:
Code: Select all
delay(50); AnimatorPlay(Angry, Portrait Image); required AnimatorPlay(Angry, Portrait Image)@{{end}}
Re: How do I stop the animation portraid
Posted: Wed Aug 24, 2022 8:03 pm
by Tony Li
Hi,
What if you tick the Wait For Close and Wait For Open checkboxes?
Re: How do I stop the animation portraid
Posted: Thu Aug 25, 2022 6:09 am
by Dralks
Thank you for answering Tony,
Where are those boxes? I suspect this will be one of those version things and I will not have them in my current version (I can't update now so close to release), if that is the case could you tell me where I could add a quick delay for the 'Sequence' command?
Apologies for asking so much, we have some heavy deadlines and dialogs are one of the last things to implement so we are just looking into details now.