Having a little issue with Item sorting..

I have 3 items in the following category’s, Apple (Food), Pistol (Weapons), Master Item (None). Whenever I pick up items and click the button related to the category the items show in that category as expected. My issue is whenever I click the ALL Button. Only the master Item shows up. I want all my items to be listed in the All category regardless of the Category type. Here Is My logic.

Check Item Type posted by anonymous | blueprintUE | PasteBin For Unreal Engine

UpdateUI posted by anonymous | blueprintUE | PasteBin For Unreal Engine

on pressed posted by anonymous | blueprintUE | PasteBin For Unreal Engine

Ik it’s something simple.. Just cant figure it out.. (Yes Im a beginner) so sorry if this is a stupid question

Do you know what the space telescope James Webb is?
Well… even with it i can not see your images

Good one. LOL. BP Links are below

links

Check Item Type posted by anonymous | blueprintUE | PasteBin For Unreal Engine

on pressed posted by anonymous | blueprintUE | PasteBin For Unreal Engine

UpdateUI posted by anonymous | blueprintUE | PasteBin For Unreal Engine

I think it can be even simpler.

Do you know how much items your inventory has previusly?

Because you can simply show/hide them whenever you want…

-Create all items from the beginning
-Create six functions

*Function1 → Show category 1
*Function2 → Show category 2
*Function3 → Show all

*Function4 → Hide category 1
*Function5 → Hide category 2
*Function6 → Hide all

To show and hide the Widget items, there is a function called “SetVisibility()”

1 Like

I think that solution complicates things for me.

Your CheckItemType function seems complicated to me. XD
You can really make things simpler.

if(ItemTypeA==ItemTypeB || ItemTypeB==None) return true;
else return false;

even simpler
return (ItemTypeA==ItemTypeB || ItemTypeB==None);

1 Like

I’m having trouble understanding.

Ok… transtate from C++ to blueprint
if → Means Branch
|| → This means “OR”
return → means the value returned by the function

For me, blueprint is more difficult than C++.
With C++ I did the same thing on just one line.

1 Like

Add an item type classification to the parent class and set it per child. Would make all of this so much easier.

2 Likes

you mean like this

1 Like

I think so, I use that method for my weapons too.

Don’t create and destroy items (reuse them)… creating and destroying will negatively affect your game’s performance. Trust me, it’s better to show and hide.

1 Like


These are the results I’m getting.

How are you structuring your inventory data wise?

Make it easier on yourself by grouping. Then show all would be as easy as looping each group and packing the results. Flush the result to UI functions for display.

data wise I only have one structure. S_ItemInfo.. and in that structure, I have an enumeration that Has each category in it…

If that’s what you mean by data..

So Im thinking the issue relies somewhere else.. cuz.. I removed the sorting and when I pickup an item only the first item I pickup is adding to the inventory..

Need to break it down more. Nested struct or multiple separate structs.

Detail data (mesh, icon, stackable etc) can be stored in a Data Table or Data Asset. You’d use a Type ID to retrieve the DT/DA information.

Struct (FOOD)

  • Apple → num
  • Orange → num
  • Bread → num
  • etc

Struct (Weapons)

  • Pistol → struct array [ID’s… 1911, 92fs, desert_eagle]
  • SMG → struct array [ID’s… bison, uzi, ]
  • AR → struct array [ID’s… m416, f2000, akm, m4a1]
  • etc

If your game only allows a specific quantity of weapons, then do slot based.
Struct (Weapons) [value is an ID]

  • Slot 1 → desert_eagle
  • Slot 2 → bison
  • Slot 3 → m4a1
  • etc
1 Like

Your solution makes absolute sense. Although I figured out the problem. I was using a size box instead of a scroll box. Now everything is working properly. But I will take your advice into consideration. Thanks for the help. @Rev0verDrive & @Ivan3z

1 Like