Trying to set an animated portrait to another speakers Animated portrait (with Sequencer command)
Posted: Thu Sep 12, 2024 4:22 pm
Hi !
I have a player character and an NPC that is kind of narrating in dialogue (The player can also talk to the narrator directly, so they need to have their own dialogue actor). I want the player portrait and the Narrator to use the portrait of whatever NPC they are talking to (which is sometimes more than one!!) I need to be able to switch the player and the narrator portraits to specific NPC portraits in dialogue. I've been trying to use the find command in unity and that doesn't seem to be doing anything.
For example:
string NPCname = GetParameter(0);
string PlayerName = GetParameter(1);
string NarratorName= GetParameter(2);
GameObject NPCObject = GameObject.Find(NPCname);
GameObject PlayerObject = GameObject.Find(PlayerName);
GameObject NarratorObject = GameObject.Find(NarratorName);
DialogueActor PlayerPortrait = PlayerObject.GetComponent<DialogueActor>();
DialogueActor NarratorPortrait = NarratorObject.GetComponent<DialogueActor>();
DialogueActor NPCPortrait = NPCObject.GetComponent<DialogueActor>();
AnimatedPortrait PlayerController = PlayerPortrait.GetComponent<AnimatedPortrait>();
AnimatedPortrait NarratorController = NarratorPortrait.GetComponent<AnimatedPortrait>();
AnimatedPortrait NPCController = NPCPortrait.GetComponent<AnimatedPortrait>();
Is there an easier way to do this? Thank you in advance!
I have a player character and an NPC that is kind of narrating in dialogue (The player can also talk to the narrator directly, so they need to have their own dialogue actor). I want the player portrait and the Narrator to use the portrait of whatever NPC they are talking to (which is sometimes more than one!!) I need to be able to switch the player and the narrator portraits to specific NPC portraits in dialogue. I've been trying to use the find command in unity and that doesn't seem to be doing anything.
For example:
string NPCname = GetParameter(0);
string PlayerName = GetParameter(1);
string NarratorName= GetParameter(2);
GameObject NPCObject = GameObject.Find(NPCname);
GameObject PlayerObject = GameObject.Find(PlayerName);
GameObject NarratorObject = GameObject.Find(NarratorName);
DialogueActor PlayerPortrait = PlayerObject.GetComponent<DialogueActor>();
DialogueActor NarratorPortrait = NarratorObject.GetComponent<DialogueActor>();
DialogueActor NPCPortrait = NPCObject.GetComponent<DialogueActor>();
AnimatedPortrait PlayerController = PlayerPortrait.GetComponent<AnimatedPortrait>();
AnimatedPortrait NarratorController = NarratorPortrait.GetComponent<AnimatedPortrait>();
AnimatedPortrait NPCController = NPCPortrait.GetComponent<AnimatedPortrait>();
Is there an easier way to do this? Thank you in advance!