Search Unity

S-Inventory: Equipment, Crafting, Skill Bar, Item Groups, Containers & Merchant (C# & JS)

Discussion in 'Assets and Asset Store' started by OussamaB, Jul 29, 2013.

Thread Status:
Not open for further replies.
  1. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    After the last update a lot of the code has been reworked and many things have changed but as my newest asset and other projects filled up my time, I was not able to update the docs quickly. I apologize for the inconvenience that this caused.

    New documentation will be available in max one week. It will be rewritten, new things will be added and it will be more organised.

    This product is still supported and will continue to be supported. Apologizes for @drakedane for not answering your e-mail. Recently I've been receiving tons of support e-mails and I might have missed yours. Please accept as an apology a code for one of my other assets: S-Quest (Please check your personal messages).

    Regarding the "base slot" and "slot parent" issue. Creating slots in S-Inventory is done by re-creating one object that represents the base slot as much as required, the created slots will then be children of the "slot parent" object which usually has the "Grid Layout Group" component to put all the slots in a certain order that you can choose.

    At the moment, please try to recreate the UI from the demo scene as I set up the documentation.

    @TonyLi Thanks a lot for your input, really appreciated.
     
    TeagansDad and TonyLi like this.
  2. drakedane

    drakedane

    Joined:
    May 23, 2017
    Posts:
    62
    Thanks so much for responding to me personally, OussamaB!

    TonyLi has been so great about supporting S-Inventory, in your absence, so I currently have no complaints.

    With TonyLi's assistance, last night, I spent a lot of time comparing your working demo with my S-Inventory installation. It took a while, but I finally managed to copy/paste all of the missing parts from your working demo into what I now guess was an older version of S-Inventory. Once I did that, the system started to make more sense to me. I was able to properly configure for the first time; and I am very excited to now have working inventory, equipment, container and vendor. I did not initially need crafting in my game; but, since you made it available, I found a way to incorporate that too! But I must admit I am still having some difficulty getting this part of the system working. Will let you know if I require any assistance with that.

    S-Inventory really is a perfect fit for my game; and so much of it seemed to work right out of the box. I am very excited to, once again, be moving forward with game dev, now that I have your Inventory system working in my game.

    I was going to check out S-Quest, once I got to that part of my game dev; so thanks so much for the offer. I really appreciate it!

    Finally, thanks so much for all of the explanation. I really was wondering what was going on. Now I understand. And thanks to TonyLi, I am very satisfied at the moment. And now that I know you are actually there and still supporting S-Inventory, I feel even more satisfied.

    So, again, thanks so much!
     
  3. MiayaJohnson

    MiayaJohnson

    Joined:
    Jun 18, 2017
    Posts:
    2
    I've got the Inventory set up now, but when I open the inventory i gt the following message.

    Setting the parent of a transform which resides in a prefab is disabled to prevent data corruption.
    UnityEngine.Transform:SetParent(Transform, Boolean)

    What have I done? Or what have I not done?
     
  4. MiayaJohnson

    MiayaJohnson

    Joined:
    Jun 18, 2017
    Posts:
    2


    Here is the exact place of the error. It's in the hover script.

    Setting the parent of a transform which resides in a prefab is disabled to prevent data corruption.
    UnityEngine.Transform:SetParent(Transform, Boolean)
    S_Inventory.SlotUI:HoverOFF() (at Assets/S-Inventory/C#/Scripts/Item/SlotUI.cs:200)
    UnityEngine.EventSystems.EventSystem:Update()
     
  5. drakedane

    drakedane

    Joined:
    May 23, 2017
    Posts:
    62
    Did you use online documentation to set up S-Inventory? If so, I discovered that those instructions are out of date (from 2014). My understanding is that a new version of S-Inventory was released that has some major changes from the older version. I have been advised to wait about a week for the new documentation to come out.

    However, having said that, because I couldn't wait, I went through long process of comparing all of the parts of the system I had installed against the working S-Inventory demo. Took a while, but I was eventually able to update everything so that it matched the working demo. Still dealing with one, minor issue. But, for the most part, S-Inventory is working.

    You might try to compare your settings against the working demo, to see if you notice any obvious problems.
     
  6. drakedane

    drakedane

    Joined:
    May 23, 2017
    Posts:
    62
    Having issues getting crafting fully working. Pretty sure the online documentation is out of date. Seems like you changed the way the recipe buttons work. I have tried to compare your working demo against my setup; and everything seems to be set up as it should be. But I will have to double check now (given issue).

    Specifically, three issues:

    1. I don't get any recipe buttons to display. So left side of the window is blank, when I run the game.

    2. I don't see any "ghost images" of the required items (like I see in demo); so no way to know what items to add (and where to add them), unless you happen to know the recipe.

    3. After dragging right items to the right slots (all of which seems to work), I click the craft button. As expected, the progress bar fills up; but, when I click the "Take Item" button (or whatever it is called), nothing happens.

    I should note that crafting WAS working, prior to me updating with my own items and recipes. So I assume I must have done something wrong. Although I should clarify: Previously, I saw two recipes listed in the inspector; but I only saw one recipe on screen. So I can't say that everything was working perfectly before; but the recipe on screen DID work: I saw the "ghost images" of the required items and I was able to successfully craft and take the crafted item.
     
  7. drakedane

    drakedane

    Joined:
    May 23, 2017
    Posts:
    62
    QUICK UPDATE: I decided to try changing the name of the "required crafting items". I was using the "display name" that I see in the vendor. But, when I used the actual name of the gameobjects for these "required items", I noticed that I now get the "ghost image" of the required elements in the slots of the crafting window. However, I am no longer able to drag and drop items into the crafting window! Since I still see no recipe buttons, it could be that I am not using the right required items. So I will delete all recipes but one, to test. I am hoping that is the issue.

    UPDATE: That test did not work. So I changed the names back to the "display names". Once again, I lose the "ghost images" of the "required items". But, once again, I am able to drag and drop items into the right slots! The progress bar fills up, when I click "craft" button. But, again, I am unable to take the final item. Since something a bit different about the final item, I will try replacing it with another item, to see if that is the issue. Otherwise, will have to wait for a reply.

    BTW, still no recipe buttons, when I run the game, even though I see a button, when I look at the UI on the canvas. I will also see if the console is logging any errors.
     
  8. drakedane

    drakedane

    Joined:
    May 23, 2017
    Posts:
    62
    Tried dev build, to see if any errors returned, when trying to craft. I started with "ghost images" of required elements. Can't drop items in crafting window, but no errors returned, when I try. I will try the other version, where I don't see any "ghost images" of the required items.
     
  9. drakedane

    drakedane

    Joined:
    May 23, 2017
    Posts:
    62
    Think I figured it out. Guess the item I was using for the final crafted item was not a proper item. This means that this was an item in that collection that was a parent with 2 child objects making up the various parts of the object. All of my other items (working perfectly) were non-parented, single objects. So guess that means you can't use parent/child objects as "final crafted items". However, I note that those items work fine as vendor items.

    Anyway, when I changed the "result item" to one of the other items that was made from a single object, then crafting worked: meaning I was able to take the final crafted item. So think I know how to proceed. BUT, having said that, I don't get to see the "ghost images" that let you know what recipe to use. So guess I still have some stuff to figure out.

    Also, I still see no recipe buttons. So I still need assistance with that part of the system. I will keep playing around with that, I guess, while waiting for a reply.

    UPDATE: I found ONE recipe button, but it is floating far below the window. I didn't notice it, until I moved the crafting window. No idea why that button is not in the window. Also I have 4 recipes, but I never see more than this one button. But, of course, even this one button has been missing for a while!
     
  10. drakedane

    drakedane

    Joined:
    May 23, 2017
    Posts:
    62
    ANOTHER UPDATE: Also noticing that the items added to crafting window remain, even after crafting done. Don't recall that happening in the demo. Also I noticed that, at some point (maybe after clicking that one recipe button) the "final item" icon changed. I had to guess the ingredients to add (because on "ghost images" of the "required items"), but I was able to drag/drop the new items over the old items and craft a new item.

    So recipe button not working still. And can't get this to work with the "ghost images" of the "required items". If I set it up so I see these "ghost images", then I cannot drag and drop the items into the slots.

    Crafting is PARTIALLY working, I guess. But not fully functional yet!
     
  11. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    To get the "ghost images," you'll need to put an image in a Resources folder. The image's name must match the name of the required item. For example, in the Demo scene examine Player > S-InventoryC# > CraftManagerC#. On the Craft Manager component, look at Recipes > Element 0 > Items Needed > Shield. The Name is set to "Shield", so S-Inventory will look in a Resources folder for an image named "Shield".

    Then assign a prefab to the Result field. In the example I just mentioned, the Axe prefab is assigned to Result. (Reminder: If you're using the Dialogue System, make sure the Axe prefab is located in a Resources folder so it can be saved and loaded in saved games.)

    If you have 4 recipes, move that mis-positioned Recipe button onto the crafting window. It should have a Slot UI component whose Slot ID is set to 0. Make three copies of this button and reposition them on the window. Change the Slot IDs to 1, 2, and 3, which correspond to the recipes you defined on CraftManagerC# (Element 0, Element 1, Element 2, and Element 3).
     
    OussamaB likes this.
  12. drakedane

    drakedane

    Joined:
    May 23, 2017
    Posts:
    62
    Thanks for reply, Tony! I made sure to have icon files to go with all of my items. And I keep everything in Resources (since I started using your Dialogue System). I was able to get icons to show up in the crafting slots. But, when I did, I was not able to drag/drop anything to the crafting slots.

    But I noticed that the web demo of S-Inventory shows item names rather than icons. So, after looking around, I realized I could untick "Show Recipe Items Sprites". Then, after playing around with the font, I was able to get text to show up in the slots! So long as the text matched the name I had given the item, it allowed me to drag and drop. So, I finally have a way of displaying the needed ingredients in a working crafting interface, which is awesome!

    It took a bit longer to get the recipe buttons working. But, ultimately, I ended up doing (more or less) what you described. However, it was not enough to simply manually create all of the buttons. I also had to disable the [new?] system that is apparently supposed to create the recipe buttons at runtime. That's what I spent so much time trying to work with and figure out. But, once I set "Base Recipe Button" to NONE, I got rid of all of the clones of the "0" button that were being created at runtime and a situation where the first button (0) was disappearing at runtime.

    Of course, at first, I thought these buttons were not functioning, because only the first recipe was displayed, no matter what button I pressed. I eventually realized that the buttons were all using the same Slot ID (0); since the 3 new buttons were just copies of the 0 button. Anyway, when I changed the slot ID's, the buttons started working. So I finally have a fully functioning crafting system, which is very exciting!

    Thanks again, Tony! Definitely could not have gotten S-Inventory working, without you!
     
  13. canaljuegos32

    canaljuegos32

    Joined:
    Jun 29, 2015
    Posts:
    63
    How to for example open a door when a "key" is in your inventory? I tried with ultimate door script and rfps, and cant maket it work even if i drop the key in the door trigger.
     
  14. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    @drakedane - I forgot to mention one thing, if you want to try using icons again in the future. The icon's import type should be Sprite (2D and UI). Otherwise S-Inventory won't load it properly from Resources.

    If you're using the Dialogue System (which I think you are) and RFPS, you can try these steps:
    1. Set the door's tag to Usable.
    2. Set the door's layer to Ragdoll/Pickups.
    3. Make sure the door has a collider.
    4. Add a Dialogue System On Pick Up Item component to the door.
    5. Set the component's Condition > Lua Conditions to:
      GetItemAmount("FPS Player", "Key") >= 1
      where "Key" is the name of the key item.
    6. Set the component's Sequence to something like
      AnimatorPlay(Open,Door);
      Audio(Creak)

      where "Door" is the name of the door GameObject, Open is an animator state on the door's animator, and Creak is an audio clip in a Resources folder.
     
    OussamaB likes this.
  15. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    S-Inventory new updated documentation will be finished at Sunday (probably even tomorrow).
    http://soumidelrio.com/docs/s-inventory/

    @TonyLi hugely appreciate you taking the time to help with the support requests. Hopefully using the new documentation, everything will be clear for all users.
     
  16. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    New documentation is now completed, take a look here: http://soumidelrio.com/docs/s-inventory/

    If anything is still not clear or some issues still come up, please let me know.
    Expect a new update in the upcoming week which will bring a lot of improvements for setting up the system in your game (minimize the work from your part and make it easy to customize the asset).
     
    TonyLi likes this.
  17. September9

    September9

    Joined:
    Jan 20, 2016
    Posts:
    20
    When I change the canvas scaler with screen size, items and inventory penal doesn't follow the mouse pointer correctly. So I temporally changed the code like below. Now it works. But I am not a professional programmer. So I hope you make better solution.

    if(DraggingItem)
    {

    DragSlot.transform.position = Input.mousePosition - new Vector3(30,30,0);

    }
     
  18. drakedane

    drakedane

    Joined:
    May 23, 2017
    Posts:
    62
    I spent about a week (or more) trying to solve issues I was having with the S-Inventory items I had created. These items all worked fine, until I implemented SAVING in my game. That's when I realized that my Items were NOT being properly saved/loaded.

    Naturally, I studied the documentation for creating items; but I didn't see anything that could help with this.

    It was only by a process of elimination (and then really thinking through the issue, when nothing else worked) that I was able to determine that the problem stemmed from the fact that the item files (icon/mesh) DID NOT have the same names as the name I had given the item, in the Item script.

    When I changed all of my file names to match the name I had given the item in the Item script, my items finally started saving/loading properly.

    Thought I would post this here, just in case anyone else encounters this same issue. I am not sure if there is anything about this somewhere else in the documentation. But it doesn't appear to be on the "Item Creation" page, which is where I expected it to be.

    Hope this helps someone else!
     
    OussamaB likes this.
  19. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Glad you got it working. But mind letting me know why did you have to change it in the first place? Because the whole UI is built around the other setting.
     
  20. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Looks like this was on me. @drakedane is using the Dialogue System's save system, and a requirement is that the prefab filename must match the item name. That info was tucked away kind of deep in the Dialogue System / S-Inventory Integration documentation.
     
    OussamaB likes this.
  21. September9

    September9

    Joined:
    Jan 20, 2016
    Posts:
    20
    I found this.

    InventoryManager.CS
    line149:
    ItemScript.Weight = PlayerPrefs.GetInt("Weight" + i.ToString(), 1);

    line297 :
    PlayerPrefs.SetInt("Weight" + TempVar.ToString(), ItemScript.Amount); //Saving the item's weight

    I think it should be
    ItemScript.Weight = PlayerPrefs.GetFloat("Weight" + i.ToString());
    PlayerPrefs.SetFloat("Weight" + TempVar.ToString(), ItemScript.Weight);
     
    Last edited: Aug 16, 2017
  22. September9

    September9

    Joined:
    Jan 20, 2016
    Posts:
    20
    I want to use S-Inv in Mobile. But every mobile has different size of screen. So I need to use the canvas saler with screensize.
     
  23. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Thanks for reporting this bug, I've fixed it and updated the asset. The same update will also present menu options that will allow you to configure a new scene for S-Inventory (create the canvas and all the required components for S-Inventory to work) as well as providing an option to create a base item from the same menu.
     
    TonyLi likes this.
  24. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Small update submitted: a build issue fixed and equipment objects in the demo scene improved.
    Thanks to @TonyLi for reporting the build issue.
     
    TonyLi likes this.
  25. Walton

    Walton

    Joined:
    May 2, 2015
    Posts:
    78
    Hi can someone please help with this error i get ive just installed S-Inventory and the support packages for Realistic FPS
    :The type or namespace name `S_Inventory' could not be found. Are you missing an assembly reference?
     
  26. thenamesace

    thenamesace

    Joined:
    Jan 25, 2014
    Posts:
    157
    Are you using the dialogue system by @TonyLi with RFPS and S-inv I believe you need all 3 systems to get S-inv to work with RFPS as the dialogue system is used as a bridge between them
     
  27. Walton

    Walton

    Joined:
    May 2, 2015
    Posts:
    78
    yes i have all 3 systems but have not tried to setup dialogue system yet( so is that why i am seeing this error)??
     
  28. thenamesace

    thenamesace

    Joined:
    Jan 25, 2014
    Posts:
    157
    Yes you need to import the dialogue system then it’s rfps/s-inv support package
     
  29. Walton

    Walton

    Joined:
    May 2, 2015
    Posts:
    78
    Yes i have them all imported and the support packages
    still get the error, I cannot setup anything because of this error..
     
  30. thenamesace

    thenamesace

    Joined:
    Jan 25, 2014
    Posts:
    157
    I have had this problem I normally import dialogue first then RFPS then s-inv then I do the s-inv support package then the RFPS/S-inv dialogue support package also make sure its the latest dialogue support package you can download the newest one from the pixal crushers website
     
  31. Walton

    Walton

    Joined:
    May 2, 2015
    Posts:
    78
    OK thanks i will give it a try
     
    OussamaB and thenamesace like this.
  32. thenamesace

    thenamesace

    Joined:
    Jan 25, 2014
    Posts:
    157
    It does work I tested it all a few weeks ago it can be a pain as your using 3 assets and it seems to be the order you install them helps
     
  33. Walton

    Walton

    Joined:
    May 2, 2015
    Posts:
    78
    Nope... i followed the order you said, and as soon has i install s-inv support package i get the error again
     
  34. thenamesace

    thenamesace

    Joined:
    Jan 25, 2014
    Posts:
    157
    Speak to @TonyLi Or check the dialogue system instructions there is a page there for installing instructions did you make sure you have got the newest Sinv-RFPS integration package from the dialogue system website ?
     
  35. Walton

    Walton

    Joined:
    May 2, 2015
    Posts:
    78
    Yes i have the latest Integration, thanks anyway i will try and get a responce from @TonyLi, but i see his last post was Aug so maybe hes does not come here often???
     
  36. thenamesace

    thenamesace

    Joined:
    Jan 25, 2014
    Posts:
    157
    @TonyLi is always about check the dialogue system thread or the rfps thread

    gonna try it myself will report back see if I get any errors
     
  37. thenamesace

    thenamesace

    Joined:
    Jan 25, 2014
    Posts:
    157
    @Walton

    rfps first
    s-inv
    dialogue system
    integrations:
    dialogue system/RFPS SUPPORT PACKAGE
    dialogue system/SINVENTORY SUPPORT PACKAGE
    dialogue system/thirdparty/sinv/RFPS SINV SUPPORT PACKAGE

    You will get that error below until you download and import the new package from the website here :
    http://www.pixelcrushers.com/dialogue-system-extras/


    Your error is now gone!

    it all works just make sure you import the updated support package for Realistic FPS Prefab 1.4. from the website as the one in the store download will give you errors with the

    "Type `FPSPlayer' does not contain a definition for `helpGuiObjInstance' and no extension method `helpGuiObjInstance'"
     
  38. Walton

    Walton

    Joined:
    May 2, 2015
    Posts:
    78
    OK Thanks i try it
     
  39. thenamesace

    thenamesace

    Joined:
    Jan 25, 2014
    Posts:
    157
    Let me know how you get on I am using Unity 2017.2.0f3

    BTW its the 5th one down on the dialogue system download page
     
    Last edited: Nov 17, 2017
  40. Walton

    Walton

    Joined:
    May 2, 2015
    Posts:
    78
    @thenamesace again thanks for trying but i followd exactly the way you said but guess what i still get the same error..
     
  41. thenamesace

    thenamesace

    Joined:
    Jan 25, 2014
    Posts:
    157
    I don't know what else to suggest I have set it up in a new project and it works fine for me downloading the assets from the store then adding the one from the downloads page
     
  42. Walton

    Walton

    Joined:
    May 2, 2015
    Posts:
    78
    Its ok i will try and get an answer from @TonyLi
     
    thenamesace likes this.
  43. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Sorry for the delay in replying. I'm in the EST time zone, so this was 4 AM for me. (Thanks @thenamesace for helping out!)

    @Walton - What versions of Unity, RFPS, and S-Inventory are you using? Can you please click on one of the error messages in the Console window, press Ctrl+C to copy it to the clipboard, then paste it into a reply?

    RFPS 1.4 introduced changes that required an update to the Dialogue System's RFPS Support package. I'll check if it also affected the S-Inventory + RFPS Support package and post back here later today with an updated package if necessary.

    In the meantime, to get your project to run again, delete the folder Assets/Dialogue System/Third Party Support/SInventory Support. You won't be able to set up the S-Inventory + RFPS part, but at least you'll be able to run your project and work on other parts of it.
     
    Last edited: Nov 17, 2017
    thenamesace likes this.
  44. Walton

    Walton

    Joined:
    May 2, 2015
    Posts:
    78
    Hi @TonyLi thanks for your reply, i am using RFPS 1.43 and S-Inv 1.3. This is the error i get:

    Assets/Dialogue System/Third Party Support/S-Inventory/RFPS S-Inventory/Scripts/FPSInventoryEvents.cs(4,7): error CS0246: The type or namespace name `S_Inventory' could not be found. Are you missing an assembly reference?

    There are 44 of these errors all going to different scripts..

    Thanks you for your help
     
  45. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    What version of Unity are you using?

    Can you update to the latest version of S-Inventory (1.33)? The Dialogue System's RFPS S-Inventory scripts support S-Inventory version 1.31 and above.
     
  46. Walton

    Walton

    Joined:
    May 2, 2015
    Posts:
    78
    Im using Unity 5.6.3 and yes i will update S-Inv

    Thankyou for your help
     
  47. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    I think updating should do it. I just tested with Unity 5.6.3. If it still gives an error, let me know and we'll get to the bottom of it.

    Remember to add the "Horizontal" and "Vertical" input definitions (Edit > Project Settings > Input).
     
  48. jtok4j

    jtok4j

    Joined:
    Dec 6, 2013
    Posts:
    322
    Hi, @Walton
    It's been a while since I encountered this error myself, but I *think* from memory... I added this line near the top of the script which was complaining about the assembly reference:

    namespace S_Inventory

    Do keep us updated, and good luck!
     
  49. canaljuegos32

    canaljuegos32

    Joined:
    Jun 29, 2015
    Posts:
    63
    Is there a way to right click in consumables to use them instead of show the action menu?
     
  50. OussamaB

    OussamaB

    Joined:
    Feb 8, 2013
    Posts:
    1,470
    Hey, PM me your e-mail and I'll send you the modified code to achieve that.
     
Thread Status:
Not open for further replies.