Files
unity-application/Assets/Common/Scripts/UserButton.cs
Dries Van Schuylenbergh 26f3322e4e Add formatting rules
2023-03-10 09:21:11 +00:00

35 lines
806 B
C#

using TMPro;
using UnityEngine;
using UnityEngine.UI;
/// <summary>
/// Handles actions when a user presses the account button (upper left corner)
/// </summary>
public class UserButton : MonoBehaviour
{
/// <summary>
/// Reference to the user list, so we can extract the current user
/// </summary>
public UserList userList;
/// <summary>
/// UI Reference to the avatar object
/// </summary>
public Image avatar;
/// <summary>
/// UI Reference to the username object
/// </summary>
public TMP_Text username;
/// <summary>
/// Start is called before the first frame update
/// </summary>
void Start()
{
User user = userList.GetCurrentUser();
avatar.sprite = user.avatar;
username.text = user.username;
}
}