Skip to content

Store Item details in own class

Easier to handle i think See example:

public class Consumable : Item
{
    public ConsumeEffects Effects { get; set; }

    public void Use(GameObject target)
    {
        var healthComponent = target.GetComponent<HealthComponent>();
        if (healthComponent != null)
        {
            healthComponent.Heal((int)Effects.Health);
        }
    }

    public struct ConsumeEffects
    {
        public int? Health { get; set; }
    }
}
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information