Search Unity

Ultimate Inventory System C#

Discussion in 'Works In Progress - Archive' started by JohnParask, Jul 7, 2014.

?

Would you buy it for $10 ?

Poll closed Feb 23, 2015.
  1. Yes

    45 vote(s)
    38.5%
  2. Maybe

    27 vote(s)
    23.1%
  3. No

    45 vote(s)
    38.5%
  1. PvTGreg

    PvTGreg

    Joined:
    Jan 29, 2014
    Posts:
    365
    when you get a chance can you test it in 4.6 as i really want to start using it
     
  2. JohnParask

    JohnParask

    Joined:
    Jul 7, 2014
    Posts:
    323
    You may add some details ? they just don't work ? any errors ?
    Try to re-import the package
     
  3. RealSoftGames

    RealSoftGames

    Joined:
    Jun 8, 2014
    Posts:
    220
    ahh talking about this asset, the drag and drop functionality is buggy as hell in unity 4.6 latest version. a few bugs with dragging and dropping, sometimes it will dupe items. cant divide stacks, and also sometimes does not allow me to move items around my inventory deletes them.
     
  4. PvTGreg

    PvTGreg

    Joined:
    Jan 29, 2014
    Posts:
    365
    with the updated script that you gave me no errors but nothing pops up to say open and when i do press to open nothing happens
     
  5. JohnParask

    JohnParask

    Joined:
    Jul 7, 2014
    Posts:
    323
    I test Ultimate Inventory on Unity 4.6 and i didn't have any problems. Everything works as i expect. In order to fix any weird bugs you may have to go on UltimateInventory prefab, then Click System Settings and reclick the "Set Slots" button just to refresh the system.

    A new feature for Ultimate Inventory :


    As you can see you can now modify the rows of your inventory and also you can preview them by pressing a button
     
    John-G likes this.
  6. PvTGreg

    PvTGreg

    Joined:
    Jan 29, 2014
    Posts:
    365
    thats awsome man hmmm wait do you use a tag system for when the player walks near the doors?
     
  7. PvTGreg

    PvTGreg

    Joined:
    Jan 29, 2014
    Posts:
    365
    that fixed it thanks man
     
  8. PvTGreg

    PvTGreg

    Joined:
    Jan 29, 2014
    Posts:
    365
    emm i cant seem to get the custom activation to work

    Code (CSharp):
    1. if (GameObject.FindGameObjectWithTag("UInventory").GetComponent<UInventory>().currentItems[itemIndex].GetComponent<UI_Item>().itemOption == "Food")
    2.         {
    3.             hungerSystem =  GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerStats>();
    4.             hungerSystem.Hunger += GameObject.FindGameObjectWithTag("UInventory").GetComponent<UInventory>().currentItems[itemIndex].GetComponent<UI_Item>().foodValue;
    5.             if (GameObject.FindGameObjectWithTag("UInventory").GetComponent<UInventory>().currentItems[itemIndex].GetComponent<UI_Item>().isPoisoned == true)
    6.             {
    7.                 //apply poison effect
    8.             }
    9.         }
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class PlayerStats : MonoBehaviour {
    5.  
    6.     public float Hunger;
    7.     public float MaxHunger = 100f;
    8.     public Texture2D HungerIcon;
    9.     public float Thirst;
    10.     public float MaxThirst = 100f;
    11.     public Texture2D ThirstIcon;
    12.     public GUISkin Skin;
    13.     public Font font;
    14.     void Start()
    15.     {
    16.         InvokeRepeating("LowerHunger", 10f, 10f);
    17.         InvokeRepeating("LowerThirst", 5f, 5f);
    18.         Hunger = MaxHunger;
    19.         Thirst = MaxThirst;
    20.  
    21.     }
    22.  
    23.  
    24.     void LowerHunger()
    25.     {
    26.         Hunger = Hunger - 1;
    27.         if (Hunger <= 0F)
    28.         {
    29.             Hunger = 0F;
    30.             InvokeRepeating("LowerHealth", 1f, 1f);
    31.         }
    32.     }
    33.  
    34.  
    35.  
    36.     void LowerThirst()
    37.     {
    38.         Thirst = Thirst - 1;
    39.         if (Thirst <= 0F)
    40.         {
    41.             Thirst = 0F;
    42.             InvokeRepeating("LowerHealth", 1f, 1f);
    43.         }
    44.     }
    45.  
    46.  
    47.  
    48.     void LowerHealth()
    49.     {
    50.         Debug.Log ("ouch!");
    51.         GetComponent<vp_PlayerDamageHandler>().Damage(0.1f);
    52.     }
    53.  
    54.     void OnGUI()
    55.     {
    56.         GUI.skin = Skin;
    57.         GUI.skin.box.fontSize = 15;
    58.         GUI.skin.box.font = font;
    59.  
    60.         GUI.Box(new Rect(40, 400, 105, 30), "Hunger : " + Hunger.ToString());
    61.         GUI.Box(new Rect(40, 430, 105, 30), "Thirst : " + Thirst.ToString());
    62.         GUI.Label(new Rect(10, 400, 100, 30), HungerIcon);
    63.         GUI.Label(new Rect(10, 430, 100, 30), ThirstIcon);
    64.         //GUILayout.Label(HungerIcon , "Hunger : " + Hunger.ToString());
    65.         //GUILayout.Label(ThirstIcon , "Thirst : " + Thirst.ToString());
    66.     }
    67.  
    68.  
    69. }
    70.  
     
    JohnParask likes this.
  9. Alfee

    Alfee

    Joined:
    Jan 4, 2015
    Posts:
    3
    Can this be bridged with UFPS?
     
    JohnParask likes this.
  10. PvTGreg

    PvTGreg

    Joined:
    Jan 29, 2014
    Posts:
    365
    i
    im currently working on it seems fairly straight forward
     
    JohnParask likes this.
  11. Sykoo

    Sykoo

    Joined:
    Jul 25, 2014
    Posts:
    1,394
    Definitely worth the money!
     
    JohnParask likes this.
  12. fuudaigel

    fuudaigel

    Joined:
    Aug 4, 2013
    Posts:
    6
    Hi! Bought it on the medieval melee sale, definitely worth the money! But i've got a problem with the Save/Load System.
    When I save it and try to load it, it loads the items i had, but i've the items just "zero-times".

    I'm looking forward to the building System, do you know when you will release it?

    Thanks!

    fuu
     
    JohnParask likes this.
  13. SIV

    SIV

    Joined:
    May 7, 2014
    Posts:
    219
    Hello,
    Great asset, i think it will be more worth when you implement uGUI, also waiting for unity 5 to come is a long time :)
     
    JohnParask likes this.
  14. PvTGreg

    PvTGreg

    Joined:
    Jan 29, 2014
    Posts:
    365
    Hi when doing custom activate i get null references and it stops it from working

    NullReferenceException: Object reference not set to an instance of an object
    UI_CustomActivation.CustomActivate (Int32 itemIndex, Boolean destroyAfterUse) (at Assets/Ultimate Inventory/Scripts/CSharp/UI_CustomActivation.cs:38)
    UInventory+<waitForActivation>c__IteratorB.MoveNext () (at Assets/Ultimate Inventory/Scripts/CSharp/UInventory.cs:1019)
     
    JohnParask likes this.
  15. JohnParask

    JohnParask

    Joined:
    Jul 7, 2014
    Posts:
    323
    Hey, sorry for late replay, make sure to email me whenever you need help because i check my emails every 2 hours.

    Anyway, the exception is caused because there is something wrong with the 'itemIndex' variable, probably there is no item on your inventory with that index. Do you remove the item after the use manually ?
     
  16. JohnParask

    JohnParask

    Joined:
    Jul 7, 2014
    Posts:
    323
    As PvTGreg said and most users said it is quite simple, however i never tried it. If you face any errors please email me at 'paraskevlos@yahoo.gr'
     
  17. JohnParask

    JohnParask

    Joined:
    Jul 7, 2014
    Posts:
    323
    Thank you for your feedback :)

    It is a must when Unity 5 comes out :)
     
  18. fuudaigel

    fuudaigel

    Joined:
    Aug 4, 2013
    Posts:
    6
    Could you help me with the save/load feature? When I save and load I only get the items shown on the right Slots, but with an amount of 0.

    Thanks
     
    JohnParask likes this.
  19. Ryanrc

    Ryanrc

    Joined:
    Mar 14, 2013
    Posts:
    14
    I was stupid to buy this before asking this question, is this compatiable with 2D?
     
    JohnParask likes this.
  20. JohnParask

    JohnParask

    Joined:
    Jul 7, 2014
    Posts:
    323
    Ahh, i think i just forgot to add this feature. I will fix it right now and i will send you the fixed script in order to avoid waiting 10 days for the patch to be accepted on the asset store.

    I never tried it but it could be with a little modification. You may try it out and email me at 'paraskevlos@yahoo.gr' for any help so i can modify the scripts for you. However don't worry we will make it work :)
     
  21. Ryanrc

    Ryanrc

    Joined:
    Mar 14, 2013
    Posts:
    14
    Awesome, you should probably make like 2 folders, 3D and 2D so people can actually use both when we're done :)
     
  22. fuudaigel

    fuudaigel

    Joined:
    Aug 4, 2013
    Posts:
    6

    Thank you!!
     
  23. Keato_

    Keato_

    Joined:
    Jan 21, 2015
    Posts:
    8
    I seem to be getting bugs where it wont let me move the items in my inventory sometimes it works and other times it wont. Then theirs also sometimes it duplicates the items.
     
    JohnParask likes this.
  24. JohnParask

    JohnParask

    Joined:
    Jul 7, 2014
    Posts:
    323
    That is a known bug which can be caused sometimes, however you can fix it within a second without loosing any of your data/settings.
    Just select the UInventory Prefab, then go System Settings, keep the number of slot the same(or if you want change it does not really matter) and then click "Set Slots". Save and it would work perfect.
     
  25. Keato_

    Keato_

    Joined:
    Jan 21, 2015
    Posts:
    8
    Can't see "Set Slots" in the System Settings.
     
    JohnParask likes this.
  26. JohnParask

    JohnParask

    Joined:
    Jul 7, 2014
    Posts:
    323
     
  27. Keato_

    Keato_

    Joined:
    Jan 21, 2015
    Posts:
    8
    Ohh right yeah i done that and saved it and still have the same bugs.
     
  28. JohnParask

    JohnParask

    Joined:
    Jul 7, 2014
    Posts:
    323
    What version of Unity are you using ?
     
  29. Keato_

    Keato_

    Joined:
    Jan 21, 2015
    Posts:
    8
    Unity 4.6.1 pro
     
  30. JohnParask

    JohnParask

    Joined:
    Jul 7, 2014
    Posts:
    323
    Did you modify the scripts ? Does the example scene works/worked ? It seems like broken settings of arrays.
     
  31. Keato_

    Keato_

    Joined:
    Jan 21, 2015
    Posts:
    8
    No i didnt touch the scripts. Yeah the example scene works but does the same thing.
     
  32. JohnParask

    JohnParask

    Joined:
    Jul 7, 2014
    Posts:
    323
    One more customer had the same problem (and i had it once) and we both fixed it by repressing Set Slots.
    Try going here and change both Inventory Slots and Number of items on HotKey menu, then and press Set Slots, and Set Row Length. If you still can't make it work make a .zip of your project and send it to 'paraskevlos@yahoo.gr' [Your project files will NOT be distributed, and all the files will be destroyed after the support.]
     
  33. Keato_

    Keato_

    Joined:
    Jan 21, 2015
    Posts:
    8
    Still didn't work ill email you the project file. Thanks :)
     
    JohnParask likes this.
  34. JohnParask

    JohnParask

    Joined:
    Jul 7, 2014
    Posts:
    323
    Sorry for the inconvenience, i will take a close look at your project and i will fix it.
     
  35. Keato_

    Keato_

    Joined:
    Jan 21, 2015
    Posts:
    8
    Is there anyways you could include an equip weapon when i press a hotbar key the weapon will show up?
     
  36. JohnParask

    JohnParask

    Joined:
    Jul 7, 2014
    Posts:
    323
    Nope, but i will add it on the next patch. ( I will send you the patch when it's ready so you don't have to wait the asset store to accept it)
     
  37. PvTGreg

    PvTGreg

    Joined:
    Jan 29, 2014
    Posts:
    365
    any news on next update?
     
  38. JohnParask

    JohnParask

    Joined:
    Jul 7, 2014
    Posts:
    323
    It would by submitted this weekend. Change Log :

    Fix : Save system will now save stuck for each item.
    Added : (A feature request by a customer) You will be able to choose whether you want to pick up items with keys when player is looking at them(Just like now) or to pick them up when you click on them(Left/Right/Middle).
    Added : (A feature request by a customer) You will be able to spawn (instantiate) an item when activated (like weapon equip system)

     
  39. Alfee

    Alfee

    Joined:
    Jan 4, 2015
    Posts:
    3
  40. JohnParask

    JohnParask

    Joined:
    Jul 7, 2014
    Posts:
    323
    Some customers had already implemented Uinventory with UFPS, and said it was pretty easy. If you buy it and you want to integrate it and you have any problems you can email me and we will fix them all. However my system is not using UI 4.6 like Master Inventory, although you get it for $20 less.

    You can make your choice, feel free to ask for anything here or at paraskevlos@yahoo.gr
     
  41. Alfee

    Alfee

    Joined:
    Jan 4, 2015
    Posts:
    3
    Okay, probably will purchase :). Will 4.6 UI ever be added?
     
    JohnParask likes this.
  42. JohnParask

    JohnParask

    Joined:
    Jul 7, 2014
    Posts:
    323
    It will be definitely added, but i don't know how much time it would need.
     
  43. DuckyIsDaBest

    DuckyIsDaBest

    Joined:
    Feb 7, 2015
    Posts:
    4
    Hey i think you should change the drop feature so when you right click it creates a sub menu on that item that say drop, split items etc
     
    JohnParask likes this.
  44. JohnParask

    JohnParask

    Joined:
    Jul 7, 2014
    Posts:
    323
    Nice idea, i will not add this on the current Inventory since i'm working on the 4.6 UI update. I will add the right click option on this.
     
  45. PvTGreg

    PvTGreg

    Joined:
    Jan 29, 2014
    Posts:
    365
    when do you think it will be ready for 4.6 gui?
     
    JohnParask likes this.
  46. DuckyIsDaBest

    DuckyIsDaBest

    Joined:
    Feb 7, 2015
    Posts:
    4
    Im just waiting to get paid then im gunna buy this you have put alot of time into this you deserver every penny you get
     
    JohnParask likes this.
  47. JohnParask

    JohnParask

    Joined:
    Jul 7, 2014
    Posts:
    323
    I don't really know, i'm a single man :eek: working on this and i don't want to do mess it up. I really appreciate your interesting though :D

    Hey thank you for your kind words, feel free to contact me for any help. :)
     
  48. RealSoftGames

    RealSoftGames

    Joined:
    Jun 8, 2014
    Posts:
    220
    you could indeed just need to bind it to the bone of your character. could do something like that. is your game going to be item intensive? if not and you are going to have only a few weapons

    when equiped to the player GUI e.g in the weapon slot.

    in that section of the code enable the weapon,

    attatch the item to the bone of the character, disable it. and then enable it when its in that slot.
     
  49. PvTGreg

    PvTGreg

    Joined:
    Jan 29, 2014
    Posts:
    365
    Ok i have uinventory and ufps working together , once i polish it ill post a video tutorial on how to do it
     
    JohnParask and John-G like this.
  50. PvTGreg

    PvTGreg

    Joined:
    Jan 29, 2014
    Posts:
    365
    Hi ive ran into a problem due to the way custom activation works i can only have 1 weapon using my method as the variable moves into the inventory how can i do this with multiple guns
    Code (CSharp):
    1. if (GameObject.FindGameObjectWithTag("UInventory").GetComponent<UInventory>().currentItems[itemIndex])
    2.         {
    3.             m_Inventory =  GameObject.FindGameObjectWithTag("Player").GetComponent<vp_PlayerInventory>();
    4.             if (m_Inventory == null) Debug.Log("m_Inventory was not found!");
    5.             Debug.Log("givin");
    6.             m_Inventory.TryGiveItem(MyItem,id:0);
    7.         }
     
    JohnParask likes this.