How to set a portrait at runtime?
Posted: Sun Sep 27, 2020 7:50 pm
Hi,
I currently am in a position where I have several selectable characters at the start of my game, and of course each one has a different portrait. I am using an actor, "Player" and currently setting the name like this:
I also have a portrait loaded when the game loads,
I would like to assign this portrait to the actor, "Player" in a similar way. I have tried things like,
and many iterations of this.
What I need to figure out is a way to set the actor's portrait at runtime. Is there a way?
Thanks!
I currently am in a position where I have several selectable characters at the start of my game, and of course each one has a different portrait. I am using an actor, "Player" and currently setting the name like this:
Code: Select all
DialogueLua.SetActorField("Player", "Display Name", playerName);
Code: Select all
Sprite playerPortrait = Resources.Load<Sprite>("PlayerCharacters/player1/Player1_portrait");
Code: Select all
Sprite playerPortrait = Resources.Load<Sprite>("PlayerCharacters/player1/Player1_portrait");
Sprite[] playerPortraits = new Sprite[1];
playerPortraits[0] = playerPortrait;
DialogueLua.SetActorField("Player", "Pictures", playerPortraits);
OR
...
DialogueLua.SetActorField("Player", "Player Portraits", playerPortraits);
...
What I need to figure out is a way to set the actor's portrait at runtime. Is there a way?
Thanks!