x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How can I use TMap for Inventory?

I was planning on implementing an abstract inventory class using a TMap to store items with their associated locations within the inventory, and expose them as readonly properties to blueprints. However, after adding the following UPROPERTY tag, it seems that I can't use TMaps as properties:

 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, etc...)

The type would be something like this:

 TMap<location_type, item_type> Items;

Is there any way to use a hashmap like this and expose it to a blueprint? I know I can implement it using a TArray, but not without creating a separate structure that stores an item's locations within the inventory. And using a TArray seems kind of like a roundabout way of doing this.

Thanks for any tips!

Product Version: Not Selected
Tags:
more ▼

asked May 25 '14 at 07:55 AM in C++ Programming

avatar image

eddyluten
96 5 4 13

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

You can't expose TMap directly to blueprints as UPROPERTY. The same goes for TSet.

To work around it, you can create UFUNCTIONS for indirect use of your property in bluepeinrs.

more ▼

answered May 25 '14 at 08:36 AM

avatar image

iniside
1.6k 102 96 181

avatar image eddyluten May 25 '14 at 08:38 AM

Thanks, I'm currently implementing it using a TArray of a custom type that contains the location within the inventory instead. I guess I'll have to do it that way. Thanks again!

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question