Hey,
How could I show the players current equipped weapon on the canvas? I need to find the name of the sprite from in the Item script that is attached to the players weapon slot and display the sprite as an image on the UI. Something like this
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class DisplayWeapon : MonoBehaviour
{
public Image CurrentWeapon;
void Start()
{
ChangeImage(newWeaponName);
}
public void ChangeImage(string newWeaponName)
{
newWeaponName = Player.Instance.transform.FindChild("WeaponSlot").GetComponent<ItemScript>().spriteNeutral.name;
CurrentWeapon.sprite = Resources.Load<Sprite>(newWeaponName);
}
}