Page cover image

Set User Avatar

Like what you're seeing?

Introduction

A simple component meant to be attached to a UnityEngine.UI.RawImage

This can update the raw image with the indicated user's avatar and can optionally pull the local user's data on start-up.

This will update if the linked user changes their avatar image.

Definition

[RequireComponent(typeof(UnityEngine.UI.RawImage))]
public class SetUserAvatar : MonoBehaviour

Events

Loaded

public UnityEvent evtLoaded;

Occurs when the texture is loaded

The handler for this event would be as such

public void HandleLoaded()
{
    //Avatar was loaded
}

Fields and Attributes

UseLocalUser

private bool useLocalUser;

This causes the component to grab the local user's ID on startup.

UserData

public UserData UserData { get; set; }

This returns the UserData that this component is currently tracking. Setting this will cause this component to track the user you set to it and is the same as calling LoadAvatar;

Methods

Load Avatar

public void LoadAvatar(UserData user);
public void LoadAvatar(CSteamID user);
public void LoadAvatar(ulong user);

Load the selected user's avatar image.

Last updated