Summ of enums in inventory system?

Hello, i have inventory system. My InventorySlots contains InventoryItem which initializes ItemSO scriptable object. ItemSO script have enum called Damage. How do i calculate summ of InventorySlots which contains InventoryItem and calculate this damage from enum.

public class InventoryItem : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDragHandler
{
    public ItemSO item;
    public int index;
    [Header("UI")]
    public TMP_Text countText;
    public Image image;
    [HideInInspector] public Transform parentAfterDrag;
    [HideInInspector] public int count = 1;

    public void InitialiseItem(ItemSO newItem)
    {
        if (newItem != null)
        {
            item = newItem;
            image.sprite = newItem.image;
            RefreshCount();
        }
    }
    public void RemoveItem(ItemSO newItem)
    {
        if (newItem != null)
        {
            item = null;
            image.sprite = null;
        }
    }


    public void RefreshCount()
    {
        countText.text = count.ToString();
        bool textActive = count > 1;
        countText.gameObject.SetActive(textActive);
    }
    public void OnBeginDrag(PointerEventData eventData)
    {
        image.raycastTarget = false;
        parentAfterDrag = transform.parent;
        transform.SetParent(transform.root);
    }
    public void OnDrag(PointerEventData eventData)
    {
        transform.position = Input.mousePosition;
    }
    public void OnEndDrag(PointerEventData eventData)
    {
        image.raycastTarget = true;
        transform.SetParent(parentAfterDrag);
    }
}
public enum Damage
{
    LG1 = 50,
    LG2 = 100,
    LG3 = 150
}

You have spammed the forums about 5 times with inventory questions.

I suggest you watch this video!

Then read this blurb below.

Start with tutorials. LOTS of them! It’s all out there—all of it. You just need to make the effort to look for it.

Here’s a simple guide to maximize your success:

How to do tutorials properly: Two (yes, only two) simple steps.

Step 1: Follow the tutorial. Every single step. Precisely. No shortcuts! No “I think I understand this part so I’ll just skip ahead.” Even the tiniest deviation—even one character—usually leads to disaster. Welcome to the world of software engineering. Every step, every letter, punctuation, spacing (or lack thereof) must be absolutely perfect! This is how it works. It’s not hard, but it’s also not optional.

You must be perfect in everything you do here. Just be a robot. A perfect, flawless robot.

If you get any errors (and you will), don’t just post here like it’s someone else’s problem. Fix it. Learn how to read the error code. Google it, because that’s the point of Google. Your error is probably a typo, especially if you’ve already skipped over a single character (which you shouldn’t have). It’s your mistake, and only you can fix it.

Step 2: Go back and do it again. But this time, explain it! To your dog, your houseplant—whoever. If you can’t explain it, then you haven’t learned it yet. Don’t skip ahead. Stop, fix it, understand it. You’ll probably need to dive into documentation or even rewatch parts of the tutorial (again, no shortcuts). If you miss this step, you’re just mindlessly typing code with no understanding. That’s how you end up hopelessly lost as soon as you step outside the tutorial’s narrow scope.

I know it’s hard, but you’ll learn something. Don’t rush. Take the time to really understand. This step is where most people fail. Without it, you’re just a code-typing monkey, no better than the next guy.

Oh, and just to be clear, all this assumes the tutorial is free from errors. For the top-tier creators (like Unity, Brackeys, Imphenzia, Sebastian Lague), you’re likely in good hands. But for others? Yeah, errors happen. If you think something’s wrong, check the comments. You’re almost certainly not the first person to notice.

Once you’ve nailed steps 1 and 2, everything else becomes easy. Seriously, easy.

Finally, when you hit an error, don’t rush to post here. Just fix it yourself. Here’s the secret:

No one memorizes error codes. That’s not a thing. Forget the code itself. What’s useful is the complete error message. That’s your goldmine.

Pay attention to the description, the file, the line number. That’s what you need to fix it.

Start with the first error. Fix that one. The rest will likely sort themselves out. And please, check the documentation. Is what you’re trying to do even possible? Are you using it correctly?

Everything you need to solve the issue is right there in the error message. Learn to identify it fast so you can keep moving forward.

… Why would you use an enum to define damage? Make it an integer or float instead.

In any case, just enumerate (loop through) the inventory, and aggregate the values. If you don’t understand these concepts, look up how to do that. This is core C# stuff. Again a lot of your questions can be answered by doing some learning of C# basics.