I made a inventory system but it only works for one of my charcter, what should i do to make it work for all of them? i followed this tutorial, link given below
first thats not a casting issue. second you didnt give us any information to work from so how do you expect us to help you. we need to know how your inventory is setup, how it functions and how you would like it to function. is this a single player game or a multiplayer? is it a shared inventory or is it separate for each character? these are basic questions just to get started with. the bottom line here is you need to give information to work with otherwise you wont get any help from anyone.
Can you share a link to your code? Show how you’re creating and using the inventory system with your character.
it’s third person shooter multiplayer game. its a shared inventory.
Technically correct and not very helpful answer is to create layer of abstraction. You need to make parent character with basic interaction with inventory and inherit other characters from it, specifying interaction for each character if needed.