Avatar from internet

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
angelothic
Posts: 6
Joined: Sun Oct 29, 2023 5:05 pm

Avatar from internet

Post by angelothic »

Hello,

I want to change player avatar with downloaded image.
Can anyone please share me how to change avatar to player (#1 id)?


Thank you.
User avatar
Tony Li
Posts: 22112
Joined: Thu Jul 18, 2013 1:27 pm

Re: Avatar from internet

Post by Tony Li »

Hi,

There are two or three steps:

1. Download the image from the Internet as a texture. See Retrieving a Texture from an HTTP Server (GET)

2. Convert the texture to a sprite. Example:

Code: Select all

Sprite sprite = PixelCrushers.DialogueSystemUITools.CreateSprite(yourDownloadedTexture2D);
3. Assign the sprite to the actor. Example:

Code: Select all

DialogueManager.masterDatabase.GetActor("Player").spritePortrait = sprite;
angelothic
Posts: 6
Joined: Sun Oct 29, 2023 5:05 pm

Re: Avatar from internet

Post by angelothic »

Thank you very much dude. Hope one day you open discord server.
Have nice week..
User avatar
Tony Li
Posts: 22112
Joined: Thu Jul 18, 2013 1:27 pm

Re: Avatar from internet

Post by Tony Li »

There's a link to the Discord server in the Dialogue System's _README.txt file.

Discord is good for discussion, but forums are better for questions because it's easier to search for previously-answered questions. Also, here on the forum you can search for "HOWTO" plus a question to get useful how-to articles.
Post Reply