Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs

We all use different programming languages here - I found from your profile that you use Unity - so I guess you're asking how to do this in Unity.  

Unfortunately, I don't use Unity, so can't help you, but for technical questions asking in their forums will probably get you an answer faster than asking here.

However, a quick search showed me these results - they're old so the code might have to be modified to newer versions - but it would point you in the right direction:

https://forum.unity.com/threads/inventory-tutorials.197096/

https://forum.unity.com/threads/inventory-system-picking-up-an-item-from-scene-a...

And more:  https://duckduckgo.com/?q=inventory+in+unity&t=ffab&ia=web