Page 1 of 1

How to change the Actor's Portrait with c# codes?

Posted: Wed Jul 08, 2020 12:42 pm
by Deadlybrunch
Hi,
Sorry to ask the stupid question. I've checked the docs about "SetPortrait()", but i dont find a definitely way to show me how to do that with a c# script.
In the docs there is a method: "static void PixelCrushers.DialogueSystem.DialogueManager.SetPortrait(string actorName, string portraitName)". And in the interpretation, it tells me that i can "Sets an actor's portrait by the name of a texture in a Resources folder". But when i typing the code, an error occured.
For example:
My actor's name is "Enemy".
And the portrait path is "Resources/Prefabs/Textures/HeadPhoto4".
Is there anything wrong with the code " PixelCrushers.DialogueSystem.DialogueSystemController.SetPortrait("Enemy", "Resources/Prefabs/Textures/HeadPhoto4"); " ?
Or is there any references about this?
Thanks for your help!

Re: How to change the Actor's Portrait with c# codes?

Posted: Wed Jul 08, 2020 1:25 pm
by Tony Li
Hi,

Here's the API info: DialogueManager.SetPortrait

Change your code to:

Code: Select all

PixelCrushers.DialogueManager.SetPortrait("Enemy", "Prefabs/Textures/HeadPhoto4");

Re: How to change the Actor's Portrait with c# codes?

Posted: Thu Jul 09, 2020 10:08 am
by Deadlybrunch
Got it, thank you very much!

Re: How to change the Actor's Portrait with c# codes?

Posted: Thu Jul 09, 2020 11:34 am
by Tony Li
Glad to help!