Page 1 of 1

Swapping Actors

Posted: Fri Jun 05, 2020 5:13 pm
by dbclutis
Hello!

I am making a VN style scene in which I am planning to use the same object for multiple actors. It seems, however, that this is not working as I initially planned. What I am doing is fading a character out, swapping the actor via its name in a single dialogue entry, and then fading the new character in. This is all done on a single actor.

It seems that this is causing the whole thing to bug out and is saying that the actor is missing an animator/subtitle, am I doing something wrong? (I can include code, etc. as well, but I am concerned that this is the wrong mindset for using the system and I wanted to check with you first.)

Thanks!

Re: Swapping Actors

Posted: Fri Jun 05, 2020 7:13 pm
by Tony Li
Hi,

Are you talking about portrait images in the dialogue UI, or some other representation of your characters?

Is there a reason why you're using a single GameObject? It's usually easier to use a separate GameObject for each character.

Re: Swapping Actors

Posted: Sat Jun 06, 2020 9:33 pm
by dbclutis
It's all mostly to keep things strait for me...

1. So, I don't guess that I see how to associate a portrait image with the dialogue UI... I am currently trying to mimic the included "Template Standard Dialogue UI," in which each there are 3 dialogue panels all with their own portrait, and all subscribe to the same "Text Field UI" as their subtitle text. What I am doing differently, however, is additionally adding an actor component to each of these Subtitle panels. So it looks like this:
error.PNG
error.PNG (46.68 KiB) Viewed 582 times
I am starting to think it may be better to have various actors already loaded in scene and have them subscribe to the panels before they fade in. Is that a perhaps a better way of doing it?

2. I was only using a single game object because that was the method that felt natural to me, since it is in a visual novel format and my portraits are the actors.. I certainly can do it a different way, I'm going to try the method I said earlier and I'll let you know if it doesn't work. If you have any suggestions, let me know!

Re: Swapping Actors

Posted: Sat Jun 06, 2020 10:42 pm
by Tony Li
Keep your actor GameObjects separate from your dialogue UI. Here's a typical setup:

vnActors.png
vnActors.png (114.32 KiB) Viewed 581 times

This way, actors can use different subtitle panels at different times. For example, actor Bob might use the right panel most of the time, but you might sometimes want to put him in the middle panel -- for example, to introduce a new character in the right panel. (You can switch panels using the [panel=#] markup tag or the SetPanel() sequencer command.)

Re: Swapping Actors

Posted: Sun Jun 07, 2020 11:18 am
by dbclutis
Ok, that makes perfect sense!

So to go from there, now I am having trouble animating the portrait tied to the subtitle panel...
I am using the sequence command "AnimatorPlayWait(animation)."

I'm aware that it is possible to reference the object directly via the sequencer event "AnimatorPlayWait(animation, Subtitle Panel 1)" but I would rather it adjust based on the portrait image associated with the subtitle panel that the actor is currently using. Is there a good way to do this??

Re: Swapping Actors

Posted: Sun Jun 07, 2020 12:41 pm
by Tony Li
Hi,

You can set a variable to the panel name. For example, let's say Bob normally uses Subtitle Panel 1, whose portrait image GameObject is named Subtitle Image 1. Set a variable "BobPanel" to "Subtitle Image 1". Then you can play an animation like this:

Code: Select all

AnimatorPlayWait(animation, [var=BobPanel])
You can switch Bob to a different panel like this:

Code: Select all

SetPortrait(Bob,2);
SetVariable(BobPanel, Subtitle Image 2);
AnimatorPlayWait(animation, [var=BobPanel])

Re: Swapping Actors

Posted: Sun Jun 07, 2020 7:50 pm
by dbclutis
Oh, brilliant!

That will work wonderfully, thank you very much!

Re: Swapping Actors

Posted: Sun Jun 07, 2020 8:58 pm
by Tony Li
Glad to help! :-)