Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

[RELEASED] Power Grid Inventory: Diablo II style inventory

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

  1. Sluggy

    Sluggy

    Joined:
    Nov 27, 2012
    Posts:
    333
    Alight! Version 1.7 has finally been released for both the regular and lite edition of PGI! Thanks to everyone who had patience with me while I played email tag and for putting up with the intermediate version with all the bugs. Also, a very special thanks to GreyFox for helping test and giving several suggestions for improvement. As before, if you need access to the lates version now and can't wait for the pending review to finish, just shoot me a message or email with your order confirmation code and I'll email you a copy of the .unitypackage.

    EDIT: Forgot to mention something important! For those of you with previous versions of PGI (and especially if I emailed you a preview of 1.7) make sure you delete your old PGI directory before upgrading! Many files have been rearranged, renamed, and removed during the course of making this update.

    As usual, here is the changelog list.

    •Fixed and updated several Tutorial scenes. Also added a feature-rich demo scene.
    •Added support for Unity 5.5 (and 5.6b too)
    •PGIView now updates on regular intervals in order to account for the fact that the new asynchronous nature of Unity's UI. This requires extra processing overhead (that is likely negligible) but ensures that it will always be properly updated.
    •Fixed bug that caused grid slots to sometimes appear far away from the grid view in z-space.
    •Fixed bug where equipment slots wouldn't update when a view was disabled and then enabled.
    •Fixed a bug where many fields would be edited but fail to flag the scene as dirty.
    •Fixed several subtle issues in PGIView and Auto-Square Slots that would cause Unity to crash when changing the size of their RectTransforms.
    •If PGIView component is removed from a GameObject it now relenquishes all child slots.
    •Made view updates in editor and at runtime a little more robust and reactive to changes.
    •Added an additional folder called 'Toolbox'. This is to make my life easier when integrating PGI with other project. Provided many additional utility files not directly related to PGI but used by it.
    •Many general-purpose utilities that were part of PGI have been moved to the Toolbox directory and had their namespaces changed to Toolbox. Some have been renamed to better reflect their use.
    •Moved the serializer 'Pantagruel' into the toolbox directory. Make sure you back up any manifest files, delete the old Pantagruel directory, and then move the manifests into the new Pantagruel folder under Toolbox.
    •Replaced PGIPointer utility class with a similar one from Toolbox namespace.
    •Replaced PGI's slot pools with Toolbox.Lazurus for easier development and much improved feature set and performance. All scripts related to the old system have also been removed.
    •Removed ability to supply a source pool for slots. Pooling is handled automatically now by Lazurus. Pools are also automatically shared by all views that use the same slot prefab.
    •Slots that are created at edit time are no longer kept during runtime. They are deleted and re-created by the pooling system. This was due to several issues cropping up in Unity 5.2+ that would cause such objects to hang around and pile up after the editor exited playmode.
    •Fixed several issues that could cause prefabs of views to fail during initialization or not properly be destroyed after exiting playmode.
    •Removed slot batching aid. It appears to be largely uneccessary now and often causes more trouble than its worth. It can be re-enabled by defining PGI_SLOT_BATCHING_AID in the player settings.
    •Pantagruel serializer no longer serializes delegates by default. If it is needed, you can always use AddTemporarySurrogate(new DelegateSurrogate()) just before serialization/deserialization.
    •Pantagruel resource manifest build tool now skips all assets not located in a Resources directory. This can greatly decrease the time it takes to build a manifest in many projects.
    •Pantagruel serializer can now be moved to any directory without needing to update the location in the Constants.cs file
    •Pantagruel deserializer now has an optional third parameter that can be used to suppress loading resources. This will disable the ability to deserialize resources saved as path strings but will allow Panatgruel to deserialize on different threads and within OnAfterDeserialize().
    •Added a progress bar with a cancel option in the resource manifest build tool.
    •Added the value Constants.ManifestNameLength to Pantagruel. It can be used to adjust the number of manifest files generated which affects the final build size of a project. Please read the comment in the file Constants.cs for details.
    •Removed editor skins system from tutorials.
    •Changed several methods in PGIModel and PGIView to return List<> instead of arrays in order to make PGI more GC friendly.
    •StackID is now called ItemTypeId. It is still used for stacking items but is now also used for model queries.
    •Added several 'Query' methods to PGIModel for item searching and sorting
    Stack splitting, Stack Decomposing, Stack reducing, Get all items, Get all items of a given id, Get a specified number of items by id (useful for crafting systems)
    •Banished many minor bugs that had been hidden deep within the darkest corners of PGIView and PGIModel.
    •Updated documentation to match PGI 1.7
     
    Last edited: Mar 8, 2017
  2. Sluggy

    Sluggy

    Joined:
    Nov 27, 2012
    Posts:
    333
    Well this is a bit late but the update is out now. Thanks all the same though!

    Interesting concept with Dialogue System for Unity. I've never used it since it seems like overkill for anything I'm working on. Considering the relative obscurity of PGI I doubt that the developer would be interested in adding such an extension but judging from what I see it probably wouldn't be too hard to add a quickly hacked-together one for yourself. Best of luck to you and if you need any pointers or help, feel free to ask.
     
  3. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,032
    @Sluggy,

    No worries. If I do sort and integration I'll share with you too.
     
  4. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,032
    @Sluggy ,

    Does this Asset support socket systems, socket items and socketable items?
     
  5. Sluggy

    Sluggy

    Joined:
    Nov 27, 2012
    Posts:
    333
    The full version does. The lite version does not.

    Also sockets, at the moment, are more of a model-side thing. There was an automatic view built into the slots but it doesn't work very well with newer versions of Unity. That's the next feature/fix on my horizon for the next release. For the time, you'll have to come up with your own system for displaying the socket information.
     
  6. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,032
    Ok. Great thanks Sluggy.
     
  7. 3DMethods

    3DMethods

    Joined:
    Jul 25, 2016
    Posts:
    2
    Getting errors when trying to build with Power Grid in a fresh project.
    Also, the save and load tutorial has errors when you use load. Using Unity 5.5.2f1 and PGI 1.7
     
  8. Sluggy

    Sluggy

    Joined:
    Nov 27, 2012
    Posts:
    333
    I appologize for the build errors. That was an oversight on my part. It can be fixed easily enough. If you open the file UIRotate.cs and around lines 31 and 48, wrap the code this.OnValidate() like so:

    #if UNITY_EDITOR
    this.OnValidate();
    #endif

    It sould then build correctly. As for the save/load error: I am aware of them and am currently working on a new solution.

    As a general announcement, the current save/load system is not recommened for much more than testing purposes. Updates to Unity or your own code tend to break it and the files it generates are far bigger than needed. I am working on a better system that will only serialize important inventory information, a list of components that can be supplied at save-time, and maybe a callback system similar to Unity's OnBeforeSerialize/OnAfterDeserialize.
     
  9. Masatorjung

    Masatorjung

    Joined:
    Jan 21, 2017
    Posts:
    1
    Hello Sluggy! I have a problem for my inventory. I use save load script that come with your asset. It work well at first. But If I load Inventory screen from other screen. The Inventory slot go to all white. I try to look at it. And I found that PGIView cant get a component of PGIModel. I think that because after I load screen. The save/load system will create a new inventory model and add component that I save to it. I try to add PGIModel to PGIView via code But it look like it cant get a PGIModel Component. And Other script that reference to Inventory Model as a gameobject to move it around the screen cant get it work too. Help me please! and Thank you for a very good asset!
     

    Attached Files:

  10. TonanBora

    TonanBora

    Joined:
    Feb 4, 2013
    Posts:
    489
    @Sluggy
    Suggestion:
    You have a nice HasRoomForItem function, but what about a function for checking multiple items?
    For example, when a player completes a quest, and the reward is multiple items, we want to make sure that the player has room for all the items before the reward can be claimed.

    Now, I could hack together something by incrementally adding the items to the inventory, and if one fails, remove them all, but that would probably trigger add/remove events, which I would like to avoid.
     
  11. Nazban

    Nazban

    Joined:
    Apr 17, 2016
    Posts:
    1
    Really good asset helped me tons thanks!
     
    Last edited: Jun 25, 2017
  12. CrystalConflux

    CrystalConflux

    Joined:
    May 25, 2017
    Posts:
    99
    I'm getting errors if the game is exited while the GameObject containing the PGIView is inactive.

    [Singleton] Instance 'Toolbox.Lazarus' already destroyed on application quit. Won't create again - returning null.
    0x000000014179F96B (Unity) StackWalker::GetCurrentCallstack
    0x00000001417A161F (Unity) StackWalker::ShowCallstack
    0x000000014177B2E0 (Unity) GetStacktrace
    0x0000000140D3DA7B (Unity) DebugStringToFile
    0x0000000140D3E25C (Unity) DebugStringToFile
    0x00000001414002F2 (Unity) DebugLogHandler_CUSTOM_Internal_Log
    0x0000000035FE156B (Mono JIT Code) (wrapper managed-to-native) UnityEngine.DebugLogHandler:Internal_Log (UnityEngine.LogType,string,UnityEngine.Object)
    0x0000000035FE1454 (Mono JIT Code) [DebugLogHandler.cs:9] UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
    0x0000000035FE0DE5 (Mono JIT Code) [Logger.cs:41] UnityEngine.Logger:Log (UnityEngine.LogType,object)
    0x0000000035FE0AE6 (Mono JIT Code) [DebugBindings.gen.cs:168] UnityEngine.Debug:LogWarning (object)
    0x00000000357B2409 (Mono JIT Code) [SingletonMonoBehaviour.cs:38] Toolbox.SingletonMonoBehaviour`1<object>:get_Instance ()
    0x00000000357C2D46 (Mono JIT Code) [Lazarus.cs:46] Toolbox.Lazarus:get_MaxPoolSize ()
    0x0000000035FE07D9 (Mono JIT Code) [Lazarus.cs:416] Toolbox.Lazarus:RelenquishToPool (UnityEngine.GameObject)
    0x000000000D4B028E (Mono JIT Code) [PGIView.cs:609] PowerGridInventory.PGIView:RelenquishAllSlots ()
    0x0000000012090BFC (Mono JIT Code) [PGIView.cs:391] PowerGridInventory.PGIView:OnDestroy ()
    0x0000000000716C42 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr)
    0x00007FFD303A5737 (mono) [mini.c:4937] mono_jit_runtime_invoke
    0x00007FFD302F8435 (mono) [object.c:2623] mono_runtime_invoke
    0x00000001410645B5 (Unity) scripting_method_invoke
    0x0000000141059DF1 (Unity) ScriptingInvocation::Invoke
    0x000000014105C15E (Unity) ScriptingInvocation::InvokeChecked
    0x000000014149B334 (Unity) MonoBehaviour::CallMethodInactive
    0x000000014149BDD8 (Unity) MonoBehaviour::WillDestroyComponent
    0x00000001409068CF (Unity) GameObject::WillDestroyGameObject
    0x0000000140D55E15 (Unity) GetComponentWithScript
    0x0000000140D55EF2 (Unity) GetComponentWithScript
    0x0000000140D55EF2 (Unity) GetComponentWithScript
    0x0000000140D55EF2 (Unity) GetComponentWithScript
    0x0000000140D55EF2 (Unity) GetComponentWithScript
    0x0000000140D57CB9 (Unity) DestroyGameObjectHierarchy
    0x0000000140D6E536 (Unity) DestroyObjectHighLevel
    0x0000000141483BDD (Unity) DestroyWorldObjects
    0x00000001414FC6D2 (Unity) EditorSceneManager::RestoreSceneBackups
    0x000000014172445D (Unity) Application::ExitPlayMode
    0x00000001417248B3 (Unity) Application::SetIsPlaying
    0x0000000141725412 (Unity) Application::TickTimer
    0x00000001417F0ABC (Unity) CrashCallback
    0x00000001417F2704 (Unity) WinMain
    0x0000000141AD7444 (Unity) strnlen
    0x00007FFD61272774 (KERNEL32) BaseThreadInitThunk
    0x00007FFD632C0D61 (ntdll) RtlUserThreadStart

    I believe it's due to OnApplicationQuit() in PGIView.cs not being called when the object is inactive.
     
    Last edited: Jul 11, 2017
  13. CrystalConflux

    CrystalConflux

    Joined:
    May 25, 2017
    Posts:
    99
    I fixed it with a change to the OnDestroy() method in PGIView.cs.

    Code (CSharp):
    1.         void OnDestroy()
    2.         {
    3.             if(!ApplicationQuitting && !Lazarus.AppQuit) RelenquishAllSlots(); //(Had to make the AppQuit field public first)
    4.         }
     
  14. Dennis59

    Dennis59

    Joined:
    Jan 8, 2013
    Posts:
    66
    Hi, I have been looking at setting up PGI for use in an authoritative multiplayer game. the description of the asset suggests based on the view and model format this should be straight forward and would suggest, to me at least, that the model would reside on the server and the view on the clients. However, there are many links between the view and model in the code making it difficult to see how to split them into commands and rpc's. Can you provide some guidance on how this could be done in a straight forward manner? Thanks
     
  15. Petethegoat

    Petethegoat

    Joined:
    Jun 12, 2013
    Posts:
    37
    It appears you have an issue in PGIView.cs, lines 838-848. DraggedItem is set to null just a few lines before trying to access it's properties. This obviously causes a null reference exception.
     
  16. Sluggy

    Sluggy

    Joined:
    Nov 27, 2012
    Posts:
    333
    Release 1.8 is nearing completion and with it come quite a few long-awaited features, like Gamepad support! To gear up for this release and hammer out any remaining issues I'm currently offering preview versions to anyone interested. This isn't just an offer for current owners of PGI either so if you are interested in getting a free, early-release version, now's your chance!

    Unfortunately, this update did required many changes to internal and public aspects of PGI so a straight upgrade path will not be possible. For anyone who will be upgrading, I recommend you backup your projects before installing 1.8.
     
    Duffer123 and Petethegoat like this.
  17. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,032
    Excellent!
     
  18. nak-dev

    nak-dev

    Joined:
    Aug 7, 2015
    Posts:
    21
    I'm a current owner, but would love to try out the new version as I'm about to implement PGI into a current project of mine.
    Cheers
     
  19. Silverlode

    Silverlode

    Joined:
    Apr 9, 2013
    Posts:
    40
    Hotbar slots were mentioned earlier in this support thread. Did they make it in? I currently own Inventory Pro but I am seriously considering switching to PGI as i use about 25% of the IP's feature and I find it fiddlely, bloated and not frequently updated anymore.

    Does PGI work with Unity 2017?
     
  20. Sluggy

    Sluggy

    Joined:
    Nov 27, 2012
    Posts:
    333
    As or right now PGI works with 5.6 through 2017.2.

    Hotbars are currently in development as part of the 1.8 update which I'm handing out to customers as a preview while I continue to work on it (going a bit slow since I'm developing it in the middle of a project). I'll admit they are a bit fiddly at times but I'm working out the kinks now.
     
    Silverlode likes this.
  21. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,032
    @Sluggy ,

    How goes it? How close now is v1.8 to release?

    If it's really close to release and pretty much settled I'd be happy to go with a preview version. I own the existing Asset.
     
  22. Sluggy

    Sluggy

    Joined:
    Nov 27, 2012
    Posts:
    333
    Just a heads up to everyone about the delays. Currently I'm working on a project that is keeping me very busy. I'm also integrating PGI into it as I go so things are going considerably slower than I originally thought. As well, some users have helped spot bugs and design issues that I'm working on. All in all things are going smoothly but very slowly. I apologize for this and hope that you will understand.

    As always, I'm still offering preview versions to anyone owners that are interested. For the most part it is now fairly stable but still has some missing core features (like save/load), some missing quality-of-life features, and a lack of proper documentation.
     
    Petethegoat likes this.
  23. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,032
    @Sluggy ,

    How goes it with the next release?
     
    nak-dev and sk4433 like this.
  24. Sh4D

    Sh4D

    Joined:
    Dec 8, 2014
    Posts:
    17
    Hi again, sorry to bother you but here is my problem : Last time I had issues because I was using an old version of PGI, so I did finally update it to 1.6, replacing once again all the parts I had modified to fit my project. I recently updated Unity because of the new VideoPlayer, my videos were badly lagging on movie textures with no valid reason. That part work fine but since I updated Unity to lattest version my PGI slots in my PGI view tend to move on the top down left of the canvas when objects are dragged or whenever... If I add the update() with updategrid() in the PGIview then the grid goes back into position but just for a second.... I can eventually rework again everything to make it work with the 1.7 update but maybe you can point me into the direction of where to look about the bugs you fixed for slots moving on lattest Unity version? Btw before Unity update that everything was working perfectly.... Maybe if I downgrade to 5.6 this doesnt occure? Any advice that will save me some time is very welcome. Thank you!

    EDIT: Ok after a lot of searching and wasted time, sadly, ResizeGrid was causing this in the UpdateView. I still don't understand why, lol but I don't have the time to understand that and the important is that I don"t need it there while I was needing it in previous versions of unity. So thats a fix :)
     
    Last edited: Jan 9, 2018
  25. sk4433

    sk4433

    Joined:
    Sep 4, 2017
    Posts:
    1
    I'm having trouble getting the PGI Slot events to trigger when I'm adding items through model.pickup(item). I want the OnStoreItem(PGISlotItem, PGISlot, PGI,Slot) event to trigger when I add an item in script through model.pickup. For some reason, they only fire on drag events.
     
  26. tylerbic

    tylerbic

    Joined:
    May 17, 2014
    Posts:
    2
    Hi, I am having trouble using the save functions built in, there is no real good example as the save load tutorial does not work. it might be because i'm running current version of unity if any one can point me in the right direction on this matter it would be much appreciated.
     
  27. nak-dev

    nak-dev

    Joined:
    Aug 7, 2015
    Posts:
    21
    Id be interested in the status of the update as well...
     
  28. schipman

    schipman

    Joined:
    Jan 22, 2010
    Posts:
    42
    I was using this in a project but then upgraded to 2017.3 and now my inventory grid is constantly flashing on and off- is there a fix for this or is a new update coming that will address? Thanks.
     
  29. Silverlode

    Silverlode

    Joined:
    Apr 9, 2013
    Posts:
    40
    If there is another update to this asset I will buy it. I really hope there is, would be sad if this was abandoned in practise even if theoretically supported. But I understand it's not always easy or simple for solo developers.
     
  30. schipman

    schipman

    Joined:
    Jan 22, 2010
    Posts:
    42
    For anyone else having the flashing issue, I followed @Sh4D 's advice and disabled the ResizeGrid call in UpdateView and that seems to have done the trick.

    Edit: Nevermind, it appears this asset is just completely broken on 2017.3 :(
     
    Last edited: Feb 10, 2018
  31. Timbecile76

    Timbecile76

    Joined:
    Jul 8, 2009
    Posts:
    238
    Anyone know how to disable dragging on a per-item basis? I see that you can do it for an entire model (like in the demo shop), but I'd rather only have a few items in the shop that are always available.
     
  32. Sluggy

    Sluggy

    Joined:
    Nov 27, 2012
    Posts:
    333
    I apologize for the lack of attention and would like to make the following announcement - Unfortunately, I will be ending support for Power Grid Inventory and removing it from the asset store shortly. There are a couple reasons for this:

    1) Unity has changed drastically since PGI first released back in 4.7. The updates are coming faster than ever and unity's UI system, on which PGI is built, is starting to show some serious cracks. It is becoming increasingly difficult to keep up with the new updates and breaks to old systems as well as maintain backward compatibility even for a few revisions previous to the latest.

    2) While point 1 is not at all insurmountable, as a solo developer I'm finding myself increasingly stretched thin. On top of that I've had to contend with several life-changing situations lately that is leaving me even shorter in time and forcing me to re-evaluate how I spend it.

    At this time I don't think it's fair to offer an asset on the store that cannot be maintain properly so I feel that pulling it is the best option for everyone. I would urge anyone that has recently made the purchase to take advantage of Unity's 30-day refund option. For those of you that are interested I will eventually provide access to a free version of the unfinished 1.8 update. Until I can get that setup, feel free to pm or email me and I'll provide you with a copy. Keep in mind, that the 1.8 update is still lacking in some features and isn't backward compatible with 1.7 but so far it does seem to at least work with 2017.x versions of Unity.

    I apologize for the inconvenience that this may cause some of you and I hope that the 1.8 patch will at least fix some of the issues that may have cropped up. Thank you for your support up to this point and good luck to all of you.

    ~James
     
    Appokalopps likes this.
  33. Razmot

    Razmot

    Joined:
    Apr 27, 2013
    Posts:
    258
    Please consider opensourcing it !
     
  34. Sluggy

    Sluggy

    Joined:
    Nov 27, 2012
    Posts:
    333
    I intend to put it up on gitbhub sometime soon. Likely it will be MIT license.
     
    kenamis likes this.
  35. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,032
    @Sluggy,

    Great. What do I have to do to get 1.8 version as a paying punter now?
     
  36. Sluggy

    Sluggy

    Joined:
    Nov 27, 2012
    Posts:
    333
  37. Silverlode

    Silverlode

    Joined:
    Apr 9, 2013
    Posts:
    40
    Even though this asset is no longer supported, I'm seriously considering using it.

    Curious if anyone has found it easy to make more feature-rich in-game shops/shopkeepers compared to the basic one in the bundled demo?

    Any general recommendations or dos/don'ts from the PGI community?
     
  38. nak-dev

    nak-dev

    Joined:
    Aug 7, 2015
    Posts:
    21
    It lets you c
    It is not restrictive at all for what you can do. That's why I love it. Other inventory systems make you tailor your games to them, but not PGI. That's why I still want to use it.
     
  39. tylerbic

    tylerbic

    Joined:
    May 17, 2014
    Posts:
    2
    This plugin is good in theory but sadly breaks down when it comes to saving and loading. I have wasted countless hours trying to make it work, no good example of how this should be done and Sluggy has unfortunately given up on it
     
  40. Sluggy

    Sluggy

    Joined:
    Nov 27, 2012
    Posts:
    333
    And here is the github link I pormised. It is the most recent 1.8 preview. If there is any interest I can also make a repo for the 1.7 since it did have slightly different features and a different API.

    PGI 1.8 Preview
    https://github.com/Slugronaut/PGI
     
  41. infixr

    infixr

    Joined:
    Jan 19, 2018
    Posts:
    1
    I need documentation. Anyone have backup?
     
  42. Sluggy

    Sluggy

    Joined:
    Nov 27, 2012
    Posts:
    333
    I can post a new link when I get home from work.
     
  43. DarkTree

    DarkTree

    Joined:
    Mar 23, 2013
    Posts:
    75
    When I reload a scene grid becomes unusable and unavailable in a new session. It looks like a rectangle or usual UI panel. Is someone have a fix of that problem? I didn't modify any core classes.

    UPD: I've found a fix. Just modify grid cells value on start and the problem will solve.


    Code (CSharp):
    1. using UnityEngine;
    2. using PowerGridInventory;
    3.  
    4. public class ModelFix : MonoBehaviour {
    5.  
    6.     PGIModel model;
    7.     public float fixTime = 0.2f;
    8.  
    9.     void Start ()
    10.     {
    11.         model = GetComponent<PGIModel>();
    12.         Invoke("Fix", fixTime);
    13.     }
    14.  
    15.     void Fix()
    16.     {
    17.         model.GridCellsX = 6;
    18.         model.GridCellsY = 5;
    19.  
    20.         print("Model was fixed");
    21.     }
    22.  
    23. }
     
    Last edited: Jun 19, 2018
    Appokalopps likes this.