How do you change or transfer ScriptableObject to a GameObject?

So I am working on an RPG, and I have created the basic items system using ScriptableObjects that exists within the inventory. My idea was to make an item ID system, assign each GameObject with the Tag: Item an ID and then have that ID correlate to a scriptable object when picked up. How would I do this? Would I need to declare a global variable that works across all scripts? If so, how would I do that?

If your weapon is a prefab I would create ScriptableObject with GameObject variable.
Than drag prefab into this scriptable object.

I would create some kind of GameItemsManager that have a list of all “items scriptable objects”.
This manager would be loaded in the beginning of the scene. Index in this manager could be ID of item.

@DSA04

You could do pretty much what was already said… do a “database” ScriptableObject, where you put all the ScriptableObject items.

Then make some methods you need, like GetItemByID(string itemID) and simply do an find in a list and return that ScriptableObject item.

Pickable items have that same ID, so you can find those from your item list.

I wouldn’t use actual scriptable object in the inventory though if that is what you said.

BTW - this is general scripting question, not a 2D question.