Hi Tony,
Sorry for bothering you again.
I wrote a script to read customs portraits Textures2D from player´s harddisk. I can import them to a C# variable, e.g.
Texture2D playerPortrait
But how I can assign that playerPortrait texture to Actor ["Player"], so I can switch to texture imported from hardisk?
Ps. Videogame in beta version in Steam now! Would you mind if i added your logo and Dialogue System to my website to let know people it was made with Unity and Dialogue Manager as the core? The Essence Reaper Ritual.
https://steamcommunity.com/app/674840
Thanks for everything
Alex.
Assign imported texture2D at run time, to Actor Picture
Re: Assign imported texture2D at run time, to Actor Picture
Hi,
Congratulations on your beta release! I'll PM you a logo image if you'd like to use it.
To assign a portrait image at runtime, add a script with an OnConversationStart method to the Dialogue Manager. The OnConversationStart method might look something like this:
Congratulations on your beta release! I'll PM you a logo image if you'd like to use it.
To assign a portrait image at runtime, add a script with an OnConversationStart method to the Dialogue Manager. The OnConversationStart method might look something like this:
Code: Select all
void OnConversationStart(Transform actor)
{
DialogueManager.conversationModel.actorInfo.portrait = // (sprite for conversation actor)
DialogueManager.conversationModel.conversantInfo.portrait = // (sprite for conversation conversant)
}
Re: Assign imported texture2D at run time, to Actor Picture
Hi Tony,
Thanks for the quick reply.
I am getting an error though;
NullReferenceException: Object reference not set to an instance of an object
1) I have assigned the Actor transform on the conversation trigger on Awake.
2) Texture2D is assigned (I tested it being used on a GUI element).
3) I import my custom Texture2D as follows;
www = new WWW(mySaveDirectory); //mySaveDirectory is path to folder and file / texture name on harddisk.
Texture2D img1 = www.texture;
public void OnConversationStart ()// (Transform actor)
{
DialogueManager.ConversationModel.ActorInfo.portrait = img1;
}
Would you know what may be wrong?
Thanks!
Alex.
Thanks for the quick reply.
I am getting an error though;
NullReferenceException: Object reference not set to an instance of an object
1) I have assigned the Actor transform on the conversation trigger on Awake.
2) Texture2D is assigned (I tested it being used on a GUI element).
3) I import my custom Texture2D as follows;
www = new WWW(mySaveDirectory); //mySaveDirectory is path to folder and file / texture name on harddisk.
Texture2D img1 = www.texture;
public void OnConversationStart ()// (Transform actor)
{
DialogueManager.ConversationModel.ActorInfo.portrait = img1;
}
Would you know what may be wrong?
Thanks!
Alex.
Re: Assign imported texture2D at run time, to Actor Picture
Hi,
What version of the Dialogue System are you using?
What part is causing the null reference exception?
What version of the Dialogue System are you using?
What part is causing the null reference exception?