Search Unity

Inventory Pro - uGUI - Performance - Mobile support & More

Discussion in 'Assets and Asset Store' started by jorisshh, Mar 8, 2015.

?

What should I build next?

  1. New currency system

    14.1%
  2. Improved serialization / saving for web

    10.8%
  3. Better properties for items (percentages, base values, etc)

    27.2%
  4. Controller support

    15.4%
  5. Unity 5.1 networking (multiplayer)

    36.9%
  6. More modular build to simplify extending

    25.1%
  7. UFPS Multiplayer (Asset integration)

    11.5%
  8. Core GameKit (Asset integration)

    4.1%
  9. Dialogue system (Asset integration)

    21.3%
  10. Wordpress integration (Asset integration)

    4.1%
Multiple votes are allowed.
  1. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    I'm now modifying the button icons and changing button triggers for the controller demo and am seeing something odd. When I changed the buttons to match the Wii U gamepad, I no longer see the A button icon on the inventory items to pick up. I dug into it and I see that it's the TriggererUI object that contains the image for this, but that it's apparently set dynamically at runtime. So, I must have done something to break where it's getting the button Icon from. Where would I look to figure out why the button icon is no longer visible? All I see now is a white square.
     
  2. jorisshh

    jorisshh

    Joined:
    Oct 6, 2009
    Posts:
    1,522
    The TriggerUI has keyIconBindings that bind a certain key input to an icon. For example, you may have 5 different triggers each with their own key code to trigger it. The keyIconBindings on the TriggerUI can then be used to assign an icon for each of these.
     
  3. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Thanks. I got it fixed.

    I have a feature request. Can you change all the components that require input assignments to just take a string instead of using the input dropdown list? It can take 20 seconds to scroll through Unity's input list and since we already know what we are going to select it's quicker to just enter it. The Input Manager allows this sort of quick text entry and it saves so much time.
     
    TeagansDad and hopeful like this.
  4. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    OK, so now most of the controller sample works on the Wii U, but there are a few issues. First, I get those errors for JIT code as I posted before. I also get another one whenever I press the A button to pick up loot on the ground:

    ExecutionEngineException: Attempting to JIT compile method 'System.Linq.OrderedEnumerable`1<Devdog.InventoryPro.ItemAmountRow>:GetEnumerator ()' while running w
    ith --aot-only.

    at System.Collections.Generic.List`1[Devdog.InventoryPro.ItemAmountRow].AddEnumerable (IEnumerable`1 enumerable) [0x00000] in <filename unknown>:0
    at System.Collections.Generic.List`1[Devdog.InventoryPro.ItemAmountRow]..ctor (IEnumerable`1 collection) [0x00000] in <filename unknown>:0
    at System.Linq.Enumerable.ToArray[ItemAmountRow] (IEnumerable`1 source) [0x00000] in <filename unknown>:0
    at Devdog.InventoryPro.ItemCollectionBaseAddCounter.TryAdd (IList`1 itemsToAdd) [0x00000] in <filename unknown>:0
    at Devdog.InventoryPro.InventoryManager.CanAddItems (Devdog.InventoryPro.ItemAmountRow[] items, Boolean rebuildCounter) [0x00000] in <filename unknown>:0
    at Devdog.InventoryPro.InventoryManager.CanAddItem (ItemAmountRow row) [0x00000] in <filename unknown>:0
    at Devdog.InventoryPro.InventoryManager.CanAddItem (Devdog.InventoryPro.InventoryItemBase item) [0x00000] in <filename unknown>:0
    at Devdog.InventoryPro.ItemTrigger.CanUse (Devdog.General.Player player) [0x00000] in <filename unknown>:0
    at Devdog.InventoryPro.ItemTrigger.Use (Devdog.General.Player player) [0x00000] in <filename unknown>:0
    at Devdog.InventoryPro.InventoryPlayer.TryPickup (UnityEngine.GameObject obj) [0x00000] in <filename unknown>:0
    at Devdog.InventoryPro.InventoryPlayer.OnTriggerEnter (UnityEngine.Collider col) [0x00000] in <filename unknown>:0

    (Filename: Line: -1)

    The buttons work fine everywhere else. I'm able to open inventory, move around the slots using the controller, and exit inventory. I'm also able to use the A button to open a Vendor and open the orange loot containers.

    One other thing I see is that when I press my inventory button I get a series of icons for Crafting, Inventory, Map, and Quest. I'm able to move to the backpack icon and open Inventory, but when I exit inventory and go back to the icon selection there is no longer a dash square selector to select the icons. I can only press B to exit and then I can go back into it and select again.

    [EDIT]
    I'm also seeing that the loot crates are showing empty when I open them on the Wii U, but they definitely have stuff in them on the dev station. It's probably due to the various errors.
     
    Last edited: Sep 8, 2016
  5. RonnyDance

    RonnyDance

    Joined:
    Aug 17, 2015
    Posts:
    557
    After updating to new Version I get following error:
    Assets/Devdog/General/Localization/Editor/LocalizedStringEditor.cs(11,18): error CS0101: The namespace `Devdog.General.Localization.Editors' already contains a definition for `LocalizedStringEditor'


    Can't compile the project anymore. Any idea?
     
  6. jorisshh

    jorisshh

    Joined:
    Oct 6, 2009
    Posts:
    1,522
    Have you downloaded the latest version of Inventory Pro? The last version is V2.5.2F2 (released several days ago). If you do and the problem persists for some reason please try deleting the config file at Assets/Devdog/General.XML and go to Tools > Devdog > Check for updates to force a new update of the general library.

    Please make sure you're on the last version of Inventory Pro first. And if you're combining it with Quest System Pro for example, make sure you're using the latest of that as well.
     
  7. RonnyDance

    RonnyDance

    Joined:
    Aug 17, 2015
    Posts:
    557
    Yeah using V2.5.2F2.
    After deleting General.XML and going to Check for Updates I have this errors:
    Code (csharp):
    1.  
    2. Couldn't determine latest Devdog.General version number. Please send this + the error just below this (stack trace) to developer at devdog.io
    3. UnityEngine.Debug:LogError(Object)
    4. Devdog.Internal.Entry:_CheckForUpdates(Action`1)
    5. Devdog.Internal.<>c__DisplayClass17_0:<CheckForUpdates>b__0()
    6. Devdog.Internal.Dispatcher:<Awake>b__2_0()
    7. UnityEditor.EditorApplication:Internal_CallUpdateFunctions()
    8.  
    9.  
    Code (csharp):
    1.  
    2. FileNotFoundException: Could not find file "D:\Unity\Way of Blood\Assets\Devdog\General.xml".
    3. System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/FileStream.cs:305)
    4. System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share)
    5. (wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
    6. System.Xml.XmlUrlResolver.GetEntity (System.Uri absoluteUri, System.String role, System.Type ofObjectToReturn)
    7. Mono.Xml2.XmlTextReader.GetStreamFromUrl (System.String url, System.String& absoluteUriString)
    8. Mono.Xml2.XmlTextReader..ctor (System.String url, System.Xml.XmlNameTable nt)
    9. System.Xml.XmlTextReader..ctor (System.String url, System.Xml.XmlNameTable nt)
    10. System.Xml.XmlDocument.Load (System.String filename)
    11. Devdog.Internal.Entry._CheckForUpdates (System.Action`1 callback)
    12.  
    13.  
    I don't have problems to delete the whole asset and import it again, since I am using only your GUI elements without any inventory DB / functionality right now. I was just wondering...
     
  8. jorisshh

    jorisshh

    Joined:
    Oct 6, 2009
    Posts:
    1,522
    I could do this, but this would invalidate all existing data + it would be a little easier to mess up (typo's and what not). I'll see if there's a nice solution for this; Unity's Input handling isn't really... great...

    Can you force Unity to use IL2CPP perhaps? I'm guessing C# AOT is used right now, which is notriously bad with LINQ and all sorts of edge cases (sounds like quite a nightmare for ios also).

    I don't own a wii license, so I can't test this; But on some platforms you can choose to use IL2CPP over Mono, can you set this for the wii platform? You can find it under Tools > Project Settings > Player > Choose the wii (u) platform at the top and go to other settings.

    Taking android as an example:


    This might fix the issue. If not, I guess I'll have to rip out all LINQ :'(
     
  9. jorisshh

    jorisshh

    Joined:
    Oct 6, 2009
    Posts:
    1,522
    Are you on a VPN or restricting outgoing calls? A very aggressive firewall perhaps? The 2nd error indicates an issue in writing the new general.XML file, are your computer's permissions set correctly? Aka, can you write to the assets folder?

    For now you can restore the xml file if you'd like or manually create it (you can just create a new empty file named Config.xml, and it should write to it automatically (assuming permissions are set))
     
  10. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    I'm almost 100% certain that IL2CPP is not available on Wii U platform, but I can check when I get home tonight. In the meantime I'll do some web searches to see if I can find the answer.

    [EDIT]
    Only iOS and WebGL have IL2CPP support according to information published by Unity.

    [EDIT 2]
    Looks like Android was added in 5.4 release. Doesn't appear to be on the Roadmap for 5.5 so doubtful we'll see it for Wii U for a very long time.
     
    Last edited: Sep 8, 2016
  11. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    So, I need to ask the question. Are you not supporting iOS or other aot platforms? Or is this supposed to work with them? I need to know if you plan to fix these aot issues and what timeline we are talking about. I need to get this up and running soon so I want to know if I need to think about alternate solutions. This also goes for Quest System Pro. I have not yet tried it, but does it also have heavy LINQ usage?
     
  12. jorisshh

    jorisshh

    Joined:
    Oct 6, 2009
    Posts:
    1,522
    Reading a little more about AOT and console platforms it seems I'm going to rip out the LINQ method calls :( - The worst part, some do work, some don't.

    Even worse, I don't have a platform to test on, as I don't have Apple for iOS (uses AOT) and I don't have a test console / license. Android has IL2CPP, but this uses Unity's own AOT, not the C# AOT, so the same problems won't persist.

    As I don't own an iPhone to test this there's not really a way I can check. I've never had a bug report about this, which, given the large amount of users, I would've expected if iOS is also affected.

    Chances are Quest System Pro is also affected by this, as it's also using LINQ. Maybe it's got less AOT issues, as it uses less LINQ, but there's still a good chance.

    Can you contact me on Skype? My username is "jorisshh". I think we might be able to get this sorted quicker through that.
     
  13. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    I will contact you on skype, but I am not able to do any testing until this evening. But at least we can chat about it.
     
  14. Arganth

    Arganth

    Joined:
    Jul 31, 2015
    Posts:
    277
    have the same problem:

    Assets/Devdog/General/Localization/Editor/LocalizedStringEditor.cs(11,18): error CS0101: The namespace `Devdog.General.Localization.Editors' already contains a definition for `LocalizedStringEditor'


    dont know if works anyway but would be nice if it goes away
    deleting/new general.xml does not work unfortunately :(
     
  15. wood333

    wood333

    Joined:
    May 9, 2015
    Posts:
    851
    typo

    pural.JPG

    Pural is a town in India.
     
  16. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    957
    @jorisshh - two quick questions for you.

    If there any way to import existing item data prefabs into the Item Database via the editor? Say I created inventory items in another project and I wanted to bring some of them over. Or if I'm starting a new database but I want to bring in some of the demo items.

    Are you still planning to build that affectors system? The last mention of it was way back in March. I'm definitely interested in this one, especially as I assume it will integrate with Inventory Pro and your line of sight system as well.
     
  17. jorisshh

    jorisshh

    Joined:
    Oct 6, 2009
    Posts:
    1,522
    Thanks, fixed for the next release :)
     
    wood333 likes this.
  18. jorisshh

    jorisshh

    Joined:
    Oct 6, 2009
    Posts:
    1,522
    Some files moved, it's easiest to delete the Assets/Devdog/General folder and the General.XMl config file and go to Tools > Devdog > Check for updates. This will re-import the whole general library.
     
  19. jorisshh

    jorisshh

    Joined:
    Oct 6, 2009
    Posts:
    1,522
    If you were to copy over the prefabs and all of it's dependencies (models, textures, etc), all you'd have to do is add the items to the database in which you'd like to use them. For example, say you import 2 models from an old project into your new one. Make sure you copy over all visuals and dependencies for that model / prefab. Then, select your item database and make sure to add your new item to the items[] array. That's it, it will now show up in the main item editor and you'll be able to re-use it throughout your project :)
     
  20. JMyerscough

    JMyerscough

    Joined:
    Jul 12, 2012
    Posts:
    117
    Hey there,

    Not sure if this is a feature request or not. I purchased this a while ago and am now just recently coming back to it. I know there's a feature of having weapons and armor appear on the player, but how hard would it be to set it up in UFPS Multiplayer?
     
  21. jorisshh

    jorisshh

    Joined:
    Oct 6, 2009
    Posts:
    1,522
    Currently, no regular items are synced across the network, only UFPS specific items. To sync your own item type you have to inherit from UFPSInventoryItemBase (this is an equipable item by default).

    Syncing the equipment of armor pieces and such wont be covered by UFPS's default networking, so this would require some custom RPC calls to get the equipment recognized on the other clients.
     
  22. cfusion

    cfusion

    Joined:
    Jul 18, 2011
    Posts:
    12
    For anyone getting the Assets/Devdog/InventoryPro/Scripts/Modules/Triggers/AdvancedTrigger.cs(39,30): error CS0115: `Devdog.InventoryPro.AdvancedTrigger.CanUse(Player)' is marked as an override but no suitable method found to override

    The issue for me was that the Player parameter was not explictly using the Devdog.General.Player class. In my case, Exit Games' Bolt package has a Player.cs that does not have a namespace, and for some reason the AdvancedTrigger defaulted to trying to use the Bolt Player and not the Devdog player.

    It was fixed by wrapping the Bolt's Player.cs in a Bolt namespace.
     
    jorisshh likes this.
  23. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Yeah, I had reported this issue as well and for me it was my own Player.cs script that conflicted so I ended up renaming mine to GamePlayer.cs.
     
  24. wood333

    wood333

    Joined:
    May 9, 2015
    Posts:
    851
    How do I hook up the skinned mesh rendering? I don't understand the correct Equipment binding settings. And, what's that check box for?

    I have a helmet correctly set up to equip to the head, but it's not moving with my character animation.
     
  25. jorisshh

    jorisshh

    Joined:
    Oct 6, 2009
    Posts:
    1,522
    The equipment handler has new options for skinned meshes. It can replace the bones on the equipped item with the bones of the character; This will be done based on the bone's names.

    Optionally, you can also force-replace the bones from the root bone of the equipped item, like so:

    Player Root Bone
    - Hips
    - Spine
    - Spine1
    - Spine 2
    ... etc


    Weapon Root bone (Spine 1)
    - Spine 2
    ... etc

    When using force replace all bones of the player, starting at Spine 1 will be replaced on the weapon.

    The equipment handler will auto. detect if the item is a skinned mesh and replace the bones where needed. So, just base an equippable item on a skinned mesh and that should do the trick :)
     
    hopeful likes this.
  26. wood333

    wood333

    Joined:
    May 9, 2015
    Posts:
    851
    My helmet has the rig. It may be that I do not understand the equipment binding.


    Equipment Binding Helmet.JPG
     
  27. jorisshh

    jorisshh

    Joined:
    Oct 6, 2009
    Posts:
    1,522
    The root bone is the 'root' for this equipment binding. For example:

    Binder: Sword (left hand)
    Equip transform: LeftHand
    Root bone: LeftArm

    Item we're equipping:

    Code (CSharp):
    1.  
    2. Sword:
    3.    LeftArm
    4.        Elbow
    5.           Hand
    6.              --- etc
    7.  

    Assuming for a moment you equip a sword that has bones left arm -> all the way to the leaf nodes. When equipping the item the root bone will be used to search for bones that are in the item; To simplify that:

    Code (CSharp):
    1.      
    2.     LeftArm (Root bone)
    3.          Elbow
    4.             Hand
    5.                 --- etc
    6.  
    Equipping the sword to the sword binder, which has LeftArm as the root will search through the LeftArm for bones that are present in the item that is being equipped (a sword).

    So, the item has to have the same bones as the LeftArm. When using force it will simply copy over the entire hierarchy from the root bone into the weapon. When not using force it will search for the bones by name.

    Hope that made sense, it's not the easiest subject to explain :p
     
    wood333 likes this.
  28. wood333

    wood333

    Joined:
    May 9, 2015
    Posts:
    851
    I'm attempting to equip a helmet, but not as a rigid item, but as a skinned mesh, like an article of clothes. When we export clothes to be worn by the player character, we export the item from Max with the entire bone structure, same names, as the player character. We do this for all the clothes.

    I think the root in our case is the same root as the player character root. I am out of town today, but will try to get this set up correctly tomorrow. As always, thank you much for your assistance.
     
  29. jorisshh

    jorisshh

    Joined:
    Oct 6, 2009
    Posts:
    1,522
    No problem :) and yes in your case the root would be the root of the character (skinned mesh). You may want to check force replace all bones, as this won't search for bones by name, but instead just copy the entire bone hierarchy downwards starting at the root bone.
     
    wood333 likes this.
  30. wood333

    wood333

    Joined:
    May 9, 2015
    Posts:
    851
    Well, no matter what combination of transforms I place in the equipment binding, I cannot get a skinned on mesh, helmet or shirt, to animate with the character. I can easily get the equipment on the character, but zippo animation.

    I would love to see a working demo scene for this. I think I could figure it out on my own.
     
  31. jorisshh

    jorisshh

    Joined:
    Oct 6, 2009
    Posts:
    1,522
    You've got it :) I'll add a demo scene to the next release
     
    wood333 and hopeful like this.
  32. Stranger-Games

    Stranger-Games

    Joined:
    May 10, 2014
    Posts:
    393
    Hi,

    I am using Dialog System for Unity and Inventory Pro with the integration. Now, I want the items to be saved if I used the Dialog System for Unity save system, is that possible?

    Thanks for advance.
     
  33. jorisshh

    jorisshh

    Joined:
    Oct 6, 2009
    Posts:
    1,522
  34. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,702
    Joris also included a DialogueSystemCollectionSaverLoader component in Inventory Pro's Dialogue System integration. Add it to every collection that you want to save. For example, in Inventory Pro's Dialogue System demo scene, you can find this component on Canvas > InventoryWindow2, which is the player's inventory collection. This way you can use the Dialogue System's save system if you want, for example to take advantage of the Menu Framework on the Extras page.
     
    hopeful and jorisshh like this.
  35. Stranger-Games

    Stranger-Games

    Joined:
    May 10, 2014
    Posts:
    393
    Exactly what I needed! Thank you very much!
     
  36. superwendel

    superwendel

    Joined:
    Jun 18, 2013
    Posts:
    105
    If working on a game that is focused on controller and keyboard only, is there a way to bring up the info box when an item is "hovered" over an object in the inventory through a controller/keyboard selection?
     
  37. wood333

    wood333

    Joined:
    May 9, 2015
    Posts:
    851
    I was reading the TradeSys forum and found this:

    TS and InvP.JPG
    Is this a collaboration, and is TradeSys going to become an official integration?
     
  38. jorisshh

    jorisshh

    Joined:
    Oct 6, 2009
    Posts:
    1,522
    Not out of the box, but you can trigger the InfoBoxUI by calling HandleInfoBox(myItem) from anywhere. I'll see if I can add a simple component to do this. Basically you'd just want to check if selection changed, and then call the HandleInfoBox, but as far as I know there's no built-in event for this, so I guess we're stuck with polling :)
     
    superwendel likes this.
  39. jorisshh

    jorisshh

    Joined:
    Oct 6, 2009
    Posts:
    1,522
    Sure seems like it; I wasn't informed, so I can't say for sure. I don't have a copy of TradeSys either.
    Do note that quite a few things changed in V2.5, so I can't say with certainty that it works. It might be easiest to contact the creator directly and ask him.
     
    wood333 likes this.
  40. dude17943

    dude17943

    Joined:
    Jun 18, 2016
    Posts:
    5
    Hi, I've been looking into your asset for my project, and it seems like there are a lot of possibilities here. I do have a couple of questions though before I jump in and purchase it that I haven't found any info on, however.

    1. In my project, I would like to have equippable items that can carry perks rather than just passive stat bonuses. For instance, if you equip a ring, you deal damage to foes when attacked. I believe this could be solved by having a separate Perk Handler script that monitors what items are equipped or something and interprets how and when to call them, but I'm not I00% sure on the methodology. Is there a built in system for this kind of thing?
    2. I've also seen on your website that you can add multiple inventories to a single character. Is there a video or documentation displaying this functionality? If combined with my above question, I believe this could be a solid solution to creating temporary status buffs and ailments.
    3. Are there any plans to for integration of this asset with the ORK Framework asset?
    Thank you for your time.
     
  41. jorisshh

    jorisshh

    Joined:
    Oct 6, 2009
    Posts:
    1,522
    Let's see :)

    1. There are a few ways to do this.
    1.1 You can create custom item types (items with different behaviors when used). You could create a custom equipable item type that sets a stat that isn't shown in the character (for example, ReflectDamage), and use this in your calculations.
    1.2 You could, when your custom item type is equipped, add a perk to a list somewhere that you use for your damage calculations.
    1.3 You could check which items are equipped in the character collection (so no custom item type), and act on that.

    Personally I'd go with option 1.2, it gives you the most freedom, and you'll probably want to make a custom item type to store the perks like reflection damage, fire damage, etc anyway, right? You can find the documentation on how to create custom item types at: http://devdog.io/unity-assets/inventory-pro/documentation/2.5p/api/creating-a-new-item-type

    2. You can simply create any number of collections and attach these to your player. When you have multiple inventories on the player the one with the highest priority is tried first, then the next, etc. You can find the docs here: http://devdog.io/unity-assets/inventory-pro/documentation/2.5p/components/player

    P.s. you can also have global inventories shared between players.

    3. Not at this time no
     
  42. davidhughes3d

    davidhughes3d

    Joined:
    Nov 30, 2012
    Posts:
    29
    Hi, is the a way to modify Inventory Pro so that it will accept Prefabs, instead of just object meshes? I am trying to hack together a GUI/Inventory solution for a VR game (used world space GUI and raycast to interact). I can get Inventory Pro to load my VR interactive gun game object , however when my gun is equipped (via the character GUI), it does go to the correct place i set it too, and fire, but it loses some functionality when it is called in through Inventory Pro.
     
  43. jorisshh

    jorisshh

    Joined:
    Oct 6, 2009
    Posts:
    1,522
    You can, of course, add any script to the items created by Inventory Pro. If you click the little eye icon in the item editor it will select the prefab, which you can modify any way you like.

    To accept prefabs you meant during the item creation? Because you can actually pick any GameObject (including prefabs) in the create new item editor.
     
    davidhughes3d likes this.
  44. davidhughes3d

    davidhughes3d

    Joined:
    Nov 30, 2012
    Posts:
    29
    Thanks for your reply. I will take a closer look at this.
     
  45. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    578
    Hi, im using 2.4 i think, i've been trying for hours to get this to work but no luck, I've searched through the forums but cant seem to find anything to help.

    Trying to get the weapons to enable from the hotbar, but not remove. RFPS is pretty simple to select which weapon you want to enable. Even with debugs nothing seems to get called. Thanx again if you can help

    Code (CSharp):
    1. sing UnityEngine;
    2. using System.Collections;
    3. using System.Collections.Generic;
    4.  
    5. using Devdog.InventorySystem;
    6. using Devdog.InventorySystem.Models;
    7.  
    8. public class JimsWeaponsEquipableItem : EquippableInventoryItem
    9. {
    10.     public int weaponToEnable;
    11.  
    12.  
    13.     public override void NotifyItemEquipped(InventoryEquippableField equipSlot, uint amountEquipped)
    14.     {
    15.         base.NotifyItemEquipped(equipSlot, amountEquipped);
    16.  
    17.         var playerWeapons = Camera.main.GetComponentInParent<ReconfigurePrefab> ().WeaponObj.GetComponent<PlayerWeapons> ();
    18.         var weaponBehavior = playerWeapons.weaponOrder[weaponToEnable].GetComponent<WeaponBehavior>();
    19.         weaponBehavior.haveWeapon = true;
    20.         StartCoroutine(playerWeapons.SelectWeapon(weaponToEnable));
    21.  
    22.     }
    23.  
    24.     public override void NotifyItemUnEquipped(CharacterUI equipTo, uint amountUnEquipped)
    25.     {
    26.         var playerWeapons = Camera.main.GetComponentInParent<ReconfigurePrefab> ().WeaponObj.GetComponent<PlayerWeapons> ();
    27.         var weaponBehavior = playerWeapons.weaponOrder[weaponToEnable].GetComponent<WeaponBehavior>();
    28.         weaponBehavior.haveWeapon = false;
    29.         StartCoroutine(playerWeapons.SelectWeapon(0));
    30.  
    31.         base.NotifyItemUnEquipped(equipTo, amountUnEquipped);
    32.  
    33.     }
    34.  
    35.  
    36.  
    37. }
     
  46. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    578
    Im really close to make this work with RFPS, I managed to add Health, Hunger, and Thirst, and also this script gives the gun kinda, but wont do the coroutine as it says the gameobject is inactive.
    Thanx a million if you can help
    Code (CSharp):
    1. using System;
    2. using UnityEngine;
    3. using System.Collections.Generic;
    4. using System.Linq;
    5. using System.Reflection;
    6. using Devdog.InventorySystem.Models;
    7. using UnityEngine.Assertions;
    8. using Devdog.InventorySystem;
    9.  
    10. public partial class JimsWeaponItemType : InventoryItemBase
    11. {
    12.     public InventoryAudioClip pickupSound;
    13.  
    14.     public int WeaponToEnable = 0;
    15.  
    16.     public override int Use ()
    17.     {
    18.         var used = base.Use ();
    19.         if (used < 0) {
    20.             return used;
    21.         }
    22.  
    23.         var playerWeapons = InventoryPlayerManager.instance.currentPlayer.gameObject.GetComponent<FPSPlayer> ().PlayerWeaponsComponent;
    24.         var weaponBehavior = playerWeapons.weaponOrder [WeaponToEnable].GetComponent<WeaponBehavior> ();
    25.  
    26.         weaponBehavior.haveWeapon = true;
    27.         StartCoroutine (playerWeapons.SelectWeapon (WeaponToEnable));
    28.  
    29.  
    30.         //currentStackSize--;
    31.         if (itemCollection != null) {
    32.             if (currentStackSize <= 0) {
    33.                 itemCollection.NotifyItemRemoved (this, ID, index, 1);
    34.                 itemCollection.SetItem (index, null, true);
    35.             }
    36.  
    37.             itemCollection [index].Repaint ();
    38.         }
    39.         return 0;
    40.     }
    41.  
    42. }
     
  47. jorisshh

    jorisshh

    Joined:
    Oct 6, 2009
    Posts:
    1,522
    The item is disabled while it's in a collection (otherwise the model would be visible while carrying the object in a collection). To remedy this you could delegate the coroutine to some other object, for example (and this is a bit of a dirty example):

    InventoryManager.instance.StartCoroutine(); // Run the coroutine on the InventoryManager script.


    Before you do this however, I would HIGHLY suggest you create a new script / component that runs your coroutines instead of using the InventoryManager :)
     
    llJIMBOBll likes this.
  48. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    578
    OMG Thank you man! I finally made it work for RFPS.
    For Guns
    Place on FPSPlayer with InventoryPlayer.cs
    Code (CSharp):
    1. using System;
    2. using UnityEngine;
    3. using System.Collections;
    4. using System.Collections.Generic;
    5. using System.Linq;
    6. using System.Reflection;
    7. using Devdog.InventorySystem.Models;
    8. using UnityEngine.Assertions;
    9. using Devdog.InventorySystem;
    10.  
    11. public class JimsInvWeapons : MonoBehaviour
    12. {
    13.     private PlayerWeapons playerWeapons;
    14.     private WeaponBehavior weaponBehavior;
    15.     public int WeaponToEnable = 0;
    16.  
    17.     void Start()
    18.     {
    19.         //So can enable Disable
    20.     }
    21.  
    22.     public void SelectWeapon()
    23.     {      
    24.         var playerWeapons = InventoryPlayerManager.instance.currentPlayer.gameObject.GetComponent<FPSPlayer> ().PlayerWeaponsComponent;
    25.         var weaponBehavior = playerWeapons.weaponOrder [WeaponToEnable].GetComponent<WeaponBehavior> ();
    26.  
    27.         weaponBehavior.haveWeapon = true;
    28.         StartCoroutine(playerWeapons.SelectWeapon(WeaponToEnable));
    29.     }
    30.  
    31. }
    This is Weapon Item Type
    Code (CSharp):
    1. using System;
    2. using UnityEngine;
    3. using System.Collections;
    4. using System.Collections.Generic;
    5. using System.Linq;
    6. using System.Reflection;
    7. using Devdog.InventorySystem.Models;
    8. using UnityEngine.Assertions;
    9. using Devdog.InventorySystem;
    10.  
    11. public partial class JimsWeaponItemType : EquippableInventoryItem
    12. {
    13.     private PlayerWeapons playerWeapons;
    14.     private WeaponBehavior weaponBehavior;
    15.     private JimsInvWeapons JimsInvGuns;
    16.  
    17.     public InventoryAudioClip pickupSound;
    18.  
    19.     public int WeaponToEnable = 0;
    20.  
    21.  
    22.     public override int Use ()
    23.     {
    24.         var used = base.Use ();
    25.         if (used < 0) {
    26.             return used;
    27.         }
    28.  
    29.         var playerWeapons = InventoryPlayerManager.instance.currentPlayer.gameObject.GetComponent<FPSPlayer> ().PlayerWeaponsComponent;
    30.         var weaponBehavior = playerWeapons.weaponOrder [WeaponToEnable].GetComponent<WeaponBehavior> ();
    31.         JimsInvGuns = InventoryPlayerManager.instance.currentPlayer.gameObject.GetComponent<JimsInvWeapons> ();
    32.  
    33.         JimsInvGuns.WeaponToEnable = WeaponToEnable;
    34.         JimsInvGuns.SelectWeapon ();
    35.  
    36.  
    37.         //currentStackSize--;
    38.         if (itemCollection != null) {
    39.             if (currentStackSize <= 0) {
    40.                 itemCollection.NotifyItemRemoved (this, ID, index, 1);
    41.                 itemCollection.SetItem (index, null, true);
    42.             }
    43.  
    44.             itemCollection [index].Repaint ();
    45.         }
    46.         weaponBehavior.haveWeapon = false;
    47.         return 0;
    48.     }
    49.  
    50. }
    Health
    Code (CSharp):
    1. using System;
    2. using UnityEngine;
    3. using System.Collections.Generic;
    4. using System.Linq;
    5. using System.Reflection;
    6. using Devdog.InventorySystem.Models;
    7. using UnityEngine.Assertions;
    8. using Devdog.InventorySystem;
    9.  
    10. public partial class JimsHealthitemType : InventoryItemBase
    11. {
    12.     public InventoryAudioClip pickupSound;
    13.  
    14.     public float restoreHealthAmount = 10f;
    15.  
    16.     public override int Use ()
    17.     {
    18.         var used = base.Use ();
    19.         if (used < 0) {
    20.             return used;
    21.         }
    22.  
    23.         var dmgHandler = InventoryPlayerManager.instance.currentPlayer.gameObject.GetComponent<FPSPlayer> ();
    24.         if (dmgHandler != null) {
    25.             if (dmgHandler.hitPoints < dmgHandler.maximumHitPoints) {
    26.              
    27.                 dmgHandler.HealPlayer (restoreHealthAmount);
    28.             } else {
    29.                 return 0;
    30.             }
    31.         }
    32.  
    33.         currentStackSize--;
    34.         if (itemCollection != null) {
    35.             if (currentStackSize <= 0) {
    36.                 itemCollection.NotifyItemRemoved (this, ID, index, 1);
    37.                 itemCollection.SetItem (index, null, true);
    38.             }
    39.  
    40.             itemCollection [index].Repaint ();
    41.         }
    42.  
    43.         //            NotifyItemUsed(1, true);
    44.         return 1;
    45.     }
    46.  
    47.  
    48. }
    Food
    Code (CSharp):
    1. using System;
    2. using UnityEngine;
    3. using System.Collections.Generic;
    4. using System.Linq;
    5. using System.Reflection;
    6. using Devdog.InventorySystem.Models;
    7. using UnityEngine.Assertions;
    8. using Devdog.InventorySystem;
    9.  
    10. public partial class JimsFoodItemType : InventoryItemBase
    11. {
    12.     public InventoryAudioClip pickupSound;
    13.  
    14.     public float restoreFoodAmount = 10f;
    15.     public float restoreHealthAmount = 5f;
    16.  
    17.     public override int Use ()
    18.     {
    19.         var used = base.Use ();
    20.         if (used < 0) {
    21.             return used;
    22.         }
    23.  
    24.         var dmgHandler = InventoryPlayerManager.instance.currentPlayer.gameObject.GetComponent<FPSPlayer> ();
    25.         if (dmgHandler != null) {
    26.             if (dmgHandler.hungerPoints - restoreFoodAmount > 0.0){
    27.                 dmgHandler.UpdateHunger (-restoreFoodAmount);
    28.                 dmgHandler.HealPlayer (restoreHealthAmount);
    29.             } else {
    30.                 return 0;
    31.             }
    32.         }
    33.  
    34.         currentStackSize--;
    35.         if (itemCollection != null) {
    36.             if (currentStackSize <= 0) {
    37.                 itemCollection.NotifyItemRemoved (this, ID, index, 1);
    38.                 itemCollection.SetItem (index, null, true);
    39.             }
    40.  
    41.             itemCollection [index].Repaint ();
    42.         }
    43.  
    44.         //            NotifyItemUsed(1, true);
    45.         return 1;
    46.     }
    47.  
    48.  
    49. }
    Drink
    Code (CSharp):
    1. using System;
    2. using UnityEngine;
    3. using System.Collections.Generic;
    4. using System.Linq;
    5. using System.Reflection;
    6. using Devdog.InventorySystem.Models;
    7. using UnityEngine.Assertions;
    8. using Devdog.InventorySystem;
    9.  
    10. public partial class JimsDrinkItemType : InventoryItemBase
    11. {
    12.     public InventoryAudioClip pickupSound;
    13.  
    14.     public float restoreDrinkAmount = 5f;
    15.     public float restoreHealthAmount = 10f;
    16.  
    17.     public override int Use ()
    18.     {
    19.         var used = base.Use ();
    20.         if (used < 0) {
    21.             return used;
    22.         }
    23.  
    24.         var dmgHandler = InventoryPlayerManager.instance.currentPlayer.gameObject.GetComponent<FPSPlayer> ();
    25.         if (dmgHandler != null) {
    26.             if (dmgHandler.thirstPoints - restoreDrinkAmount > 0.0){
    27.                 dmgHandler.UpdateThirst (-restoreDrinkAmount);
    28.                 dmgHandler.HealPlayer (restoreHealthAmount);
    29.             } else {
    30.                 return 0;
    31.             }
    32.         }
    33.  
    34.         currentStackSize--;
    35.         if (itemCollection != null) {
    36.             if (currentStackSize <= 0) {
    37.                 itemCollection.NotifyItemRemoved (this, ID, index, 1);
    38.                 itemCollection.SetItem (index, null, true);
    39.             }
    40.  
    41.             itemCollection [index].Repaint ();
    42.         }
    43.  
    44.         //            NotifyItemUsed(1, true);
    45.         return 1;
    46.     }
    47.  
    48.  
    49. }
    Just have Ammo to add, I'll update once I done it

    Thanx Again Man Jimbob

    Ammo
    Code (CSharp):
    1. using System;
    2. using UnityEngine;
    3. using System.Collections;
    4. using System.Collections.Generic;
    5. using System.Linq;
    6. using System.Reflection;
    7. using Devdog.InventorySystem.Models;
    8. using UnityEngine.Assertions;
    9. using Devdog.InventorySystem;
    10.  
    11. public partial class JimsAmmoItemType : EquippableInventoryItem
    12. {
    13.     public InventoryAudioClip pickupSound;
    14.  
    15.     public int weaponNumber = 0;
    16.     public int ammoToAdd = 1;
    17.  
    18.     public override int Use ()
    19.     {
    20.         var used = base.Use ();
    21.         if (used < 0) {
    22.             return used;
    23.         }
    24.  
    25.         var playerWeapons = InventoryPlayerManager.instance.currentPlayer.gameObject.GetComponent<FPSPlayer> ().PlayerWeaponsComponent;
    26.         var weaponBehavior = playerWeapons.weaponOrder [weaponNumber].GetComponent<WeaponBehavior> ();
    27.  
    28.         if (weaponBehavior.ammo < weaponBehavior.maxAmmo) {
    29.  
    30.             if (weaponBehavior.ammo + ammoToAdd >= weaponBehavior.maxAmmo) {
    31.                 //just give player max ammo if they only are a few bullets away from having max ammo
    32.                 weaponBehavior.ammo = weaponBehavior.maxAmmo;  
    33.             } else {
    34.                 //give player the ammoToAdd amount
    35.                 weaponBehavior.ammo += ammoToAdd;
    36.             }
    37.  
    38.         } else {
    39.             return 0;
    40.         }      
    41.  
    42.         currentStackSize--;
    43.         if (itemCollection != null) {
    44.             if (currentStackSize <= 0) {
    45.                 itemCollection.NotifyItemRemoved (this, ID, index, 1);
    46.                 itemCollection.SetItem (index, null, true);
    47.             }
    48.  
    49.             itemCollection [index].Repaint ();
    50.         }
    51.  
    52.         return 1;
    53.     }
    54.  
    55. }
     
    Last edited: Sep 29, 2016
  49. JBR-games

    JBR-games

    Joined:
    Sep 26, 2012
    Posts:
    708
    Hey wanted to point out a super annoying bug i just found in Inventory Pro..

    if you you go to editor tools and click the db button it puts you in an endless loop, if you cant find a database to use. there needs to be a cancel button here..
     
  50. jorisshh

    jorisshh

    Joined:
    Oct 6, 2009
    Posts:
    1,522
    Yep, added to V2.5.3 (you'll be able to create a database directly from the window) :)