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"

Casting to another blueprint in the widget visibility graph


I have set up a system that will display a widget dependent on a variable. If the variable returns true, the widget will become visible, and if the variable returns false the widget will become hidden. This system works perfectly when I am referencing to the Third Person Character as casting is very simple with the third person character. (I can just use get player character for the object):

alt text


The issue I am experiencing is when I cast to a different blueprint other than the third person character. For example an actor, the widget will remain visible (which is it's default state) meaning that it doesn't recognize whatever I am casting to the blueprint variable so it can't return true or false. I'm not sure how to cast to another blueprint, and non of the tutorials online have been helpful unfortunately. This is a picture of the blueprint I am using:
alt text

Any help would be appreciated, thanks!

Product Version: UE 4.14
more ▼

asked Jun 03 '18 at 08:21 PM in Blueprint Scripting

avatar image

Alec R
110 4 9 17

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

You need a reference to the object you are "casting" to. So in your case "WoodInventPickUp" needs to have something fed into the object pin hence the error. Your cast will always fail the way you have it set up. Use an overlap or hit event or other such event to get the reference to the "WoodInventPickUp" and you should be fine.

more ▼

answered Jun 03 '18 at 10:00 PM

avatar image

Nebula Games Inc
5.4k 28 9 15

avatar image Alec R Jun 03 '18 at 10:17 PM

In other blueprints I have set up a overlap or hit to get the object event but in the widget blueprints, this doesn't seem to work. How would I go about doing this?

avatar image Nebula Games Inc Jun 03 '18 at 10:24 PM

You must be "collecting" this inventory item somehow and then calling the function in the widget BP. So what you need to do is wherever you are coding that "player has picked up inventory item", whatever event that is should store a reference to the actual object. Then you need to create a path from widget to that blueprint to get the reference OR whatever BP calls this widget function you could just add an object as an input and give it directly to the function from the BP that calls this widget function. So for example, say in Player BP you have an overlap event that identifies the object overlapping the player as a "pick up" item. You then call this function by referencing the widget in the Player BP. What you can do is "add input" to the function in the widget to receive an "object" reference and as soon as the player overlaps the item within the Player BP call this function and drag from "overlapped actor" into the newly created "input" on the widget function and the rest will take care of itself. You can use that object input in the cast.

avatar image Alec R Jun 04 '18 at 03:13 AM

I hope this is not too much to ask, but could you show me how this would look if it was set up correctly in the proper blueprints?

avatar image Nebula Games Inc Jun 04 '18 at 06:47 PM

This is the set-up I was referring to. But to be honest, this is a pretty bad set-up for what you are trying to do. You will be making a new function for each "pick up" or you will have a long list of "casts" in one function, like "cast to wood" if fails "cast to stone" if fails "cast to gold" etc. What you probably should do instead is just have a parent "pick up BP" and that parent BP gets a reference to the inventory widget so when you overlap the "pick up" set widget visibility to "visible" and when finished overlapping "set visibility to hidden". But for your specific situation if you want it how you currently have it this is how to do it.

alt text

alt text

pick-up-part-1.jpg (152.7 kB)
pick-up-part-2.jpg (101.8 kB)
avatar image Alec R Jun 04 '18 at 07:15 PM

I'll try both solutions and see which one works better. Thank you! You've been very helpful (I have been stuck on this for so long) .

avatar image Alec R Jun 15 '18 at 01:30 AM

Hi, I know I'm getting back to you late but I recently had a hard drive failure and I've just been able to test out the solutions now. Unfortunately I can't seem to find out how you got the custom visibility function working, if you can, could you help me with that?

avatar image Nebula Games Inc Jun 15 '18 at 02:07 AM

It's a function you create in the widget I just named it "custom visibility" that's supposed to represent whatever you wanted to do with the visibility.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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