Search Unity

[RELEASED] Power Grid Inventory: Diablo II style inventory

Discussion in 'Assets and Asset Store' started by Sluggy, May 26, 2015.

  1. schipman

    schipman

    Joined:
    Jan 22, 2010
    Posts:
    45
    It's actually been working great for me in 2019.3 believe it or not. Oh well, I guess I will have to figure this out myself.
     
    a2884350 likes this.
  2. Sluggy

    Sluggy

    Joined:
    Nov 27, 2012
    Posts:
    989
    Hahaha, well, that is nothing short of miraculous that it does! i couldn't even get it working properly in 2017.1! The problem was that the UI system was changing so frequently with undocumented changes that it basically required a manual testing and per-version rewrites of core systems with every quarterly update to Unity. This eventually became way more of a hassle than it was worth so I ended support. I'm glad it's apparently working for you though :D

    If I were to do it again now, I'd definitely make use of ScriptableObjects. A an 'InventoryItem' component could be attached to the game object and all it would have is a reference to a single 'InventoryItemDefinition' ScriptableObject that would store all of the relevant information. This would drastically cut down on memory usage, simplify maintenance of lots of items, and make serialization a snap.
     
    a2884350 and TeagansDad like this.
  3. a2884350

    a2884350

    Joined:
    Jun 22, 2019
    Posts:
    3
    Thanks Sluggy.
    I use it in 2019.2.3f1,it works well.But there is a problem.when PGI is active,it cost a lot cpu main time...
    Is someone have a fix of that problem?
    active:
    2020517-160740.png
    not active:
    2020517-161008.png
     
    Last edited: May 17, 2020
  4. Sluggy

    Sluggy

    Joined:
    Nov 27, 2012
    Posts:
    989
    While I don't have time to fix anything myself but I can tell you the likely culprit. At some point I had to change the view update system from one that only updated the UI when a change was detected to one that had to update every frame. This was due to several internal changes in Unity's UI system that made it very difficult to do it the former way. You could probably go in to the View.cs file and look around for the code that draws the grid and change in in some way to only perform that action when changes to your model are made (I probably still have the stubs for the Dirty flag in the code) but be warned that it might cause issues elsewhere with the UI rendering, especially when activating or deactivating the view.
     
    a2884350 and Duffer123 like this.
  5. a2884350

    a2884350

    Joined:
    Jun 22, 2019
    Posts:
    3
    Thanks.I understand.I well do as you say if it becomes necessary.
     
  6. LintyFlent

    LintyFlent

    Joined:
    Jul 2, 2020
    Posts:
    1
    Thank you to the developer for such a great inventory system! Surprisingly, this is the best solution I have found in the Unity asset store, as I am not yet able to develop such a system on my own. On unity version 2019.4.5f1 everything works fine! However, the save system has not been tested, and it confuses me that all the main code is in several scripts.
     
    Last edited: Oct 9, 2020
  7. miroslaw

    miroslaw

    Joined:
    Nov 15, 2012
    Posts:
    70
    Using this in 2020. Managed to store inventory data in a database and load it up again for players. This really is an amazing tool. Thanks a lot for this Sluggy!

    Only thing I wish for is the 3D item in inventory to work. At the moment I am forced to use sprites because the 3D item renderer is buggy (completely black material and sort of visible models) in Unity 2020.1.6f1
     
  8. Sluggy

    Sluggy

    Joined:
    Nov 27, 2012
    Posts:
    989
    Been a long time since I looked at PGI (and I still highly recommend not using it) but I believe the 3D icon requires an unlit shader in order for it to be visible since the default lighting will not affect the UI. Try playing around with Unity's unlit shaders and see if one works.
     
  9. drcfrx

    drcfrx

    Joined:
    Jan 26, 2013
    Posts:
    53
    @Sluggy or anyone, can someone post a backup of the Docs somewhere please? All the links I find are dead :/ Thanks!
     
  10. lightsedge

    lightsedge

    Joined:
    Apr 25, 2017
    Posts:
    3
    Why does PGI use XML Serializer rather than JSON Serializer? What's the difference?
     
  11. Sluggy

    Sluggy

    Joined:
    Nov 27, 2012
    Posts:
    989
    It was what I was most familiar with at the time.

    I'm actually surprised when people still occasionally respond to this thread. And when I see such things I feel a little bit that it's my responsibility to re-iterate that this project is badly outdated and I do not suggest using any aspect of it anymore.
     
  12. lightsedge

    lightsedge

    Joined:
    Apr 25, 2017
    Posts:
    3
    There isn't much choice for Multi-Slot Item Inventory System in Asset Store. PGI may be outdated but still very helpful, at least educational. Thanks again for your work!
     
    Sluggy likes this.
  13. Sluggy

    Sluggy

    Joined:
    Nov 27, 2012
    Posts:
    989
    In light of more recent events I feel it may also be my responsibility to to recommend not using Unity at all. The decisions they are making are clearly not to the benefit of game developers and it seems the medium-to-long term viability of this engine as a platform is in severe jeopardy.

    As well, apparently the CEO thinks a vast number of we Unity devs are 'F***ing idiots' (his words, not mine).
     
  14. Sluggy

    Sluggy

    Joined:
    Nov 27, 2012
    Posts:
    989
    UPDATE:
    A new version of Power Grid Inventory is under construction! It is being designed from the ground up in Unity 2022 to take advantage of all the new features Unity has to offer including an updated version of C# and the new GUI system UIToolkit. It also relies more on ScriptableObjects for shared data as well as provides uses both MonoBehaviour and Non-MonoBehaviour data models.

    This is not a commercial project and will not be up for sale. I am simply in need of a system like this for my own personal projects and thought I would share it as I know there are a handful of others dying for such a system. As such I will not be taking feature requests or providing offical support in any way. Exceptions might be made for answering simple questions on use... if I've had enough coffee that morning.

    Odin is absolutely required for this project. I have zero desire to write editors and drawers if I don't have to. Strictly speaking, one could work around it by removing the drawer attributes or by providing their own attribute drawers to mimic behavior.

    You can find the link to the new project repo here
    https://github.com/Slugronaut/PGIA


    For historical sake and backwards compatibility I still have the old version here. I HIGHLY recommend you use the version linked above.
    https://github.com/Slugronaut/PGI
     
    Duffer123 and kenamis like this.
  15. bravepower

    bravepower

    Joined:
    Nov 5, 2012
    Posts:
    3
    Thank you for sharing the new version of Power Grid Inventory. This is exactly what I've been looking for. I appreciate you updating it for newer versions of Unity.

    Do you have any documentation on how to get started using this package? Would it be helpful to look at the old PGI documentation? It looks like your website is down so I can't access the documentation that was there.
     
  16. Sluggy

    Sluggy

    Joined:
    Nov 27, 2012
    Posts:
    989
    I do not have any documentation at this time but I'll try to rectify that soon. For the most part you need to have a model, a view, and then a couple of scriptable object assets. The assets can be created using the context menu and looking for PGIA. There is also a default cursor asset that comes with it.
     
    bravepower likes this.
  17. Sluggy

    Sluggy

    Joined:
    Nov 27, 2012
    Posts:
    989
    I've updated the readme on the github with a very basic getting started guide. It's not quite complete yet but it should be enough to get you pretty well started.

    Take note that there is a slight bug atm. After you create the Drag Cursor object and setup all of your links it will be out of sync due to how Unity handles ScriptableObject lifetimes. It will throw a null-ref exception when you enter playmode but this can be fixed by simply restarting Unity. I'll try to fix this issue later tonight.
     
    bravepower likes this.
  18. bravepower

    bravepower

    Joined:
    Nov 5, 2012
    Posts:
    3
    Thank you for the quick response. I'll give this a try soon and let you know any questions I have. This looks awesome, I appreciate it.
     
    Sluggy likes this.