Search Unity

A weight based inventory system in unity c#

Discussion in 'Scripting' started by W7nk, May 18, 2019.

  1. W7nk

    W7nk

    Joined:
    Jan 5, 2019
    Posts:
    1
    So, I have been looking around for a way to do a weight based inventory system in this survival game, I'm working on, and I haven't been able to find a good tutorial on one yet, anyone know one or have a basic idea to get me headed in the right direction?


    Thanks
     
  2. asd234w4r5

    asd234w4r5

    Joined:
    Oct 4, 2012
    Posts:
    881
    What is your problem? Just not knowing how to do something isnt enough info for us to help you. Did you like write down what you want to achieve?
     
  3. Dextozz

    Dextozz

    Joined:
    Apr 8, 2018
    Posts:
    62
    "Weight inventory" is basically the same as the normal inventory, the only thing that's different is that it won't let you pick up objects if that would make you over-encumbered? Simply make a class "Item" which stores the info of all of the objects you pick up, along with their weight. Every time you pick up the object check if the new value added to the current one will cross the maximum holding value.
     
    JWLewis777 likes this.