I want an orb image in my UMG widget to disappear initially in-game and then once the player collects all 500 gems of the level, the orb image appears on the widget.
Are you sure youâre referencing the correct image widget? In your first picture you have 3 image widgets. Also if you just want to have the image hidden from the start. Go to the designer tab, select the image and go to Behavior > Visibility and set it to hidden there.
I did a debug by linking the âCast Failedâ to a âPrint Stringâ which prints âCast Failed!â.
Itâs not the problem with the image but it is a failed cast. I need to cast to âSheila the Foxâ or I will get an error about a mismatched targets.
There isnât anything unreliable about casting in UE4 and I see a lot of devs making this mistake on this forum. The âCast toâ node is actually a thing in programming called âType Castingâ or âType Conversionâ, you can look it up for clarification on what itâs definition is. Here is an example of how itâs used in UE4 blueprints:
[Get Player Pawn] -> [Cast To âCustomPlayerBlueprintâ] -> [DoPlayerEventOrGetPlayerProperty]
You see, the Cast To node changes the type (Or itâs class) from the Get Player Pawn reference to CustomPlayerBlueprint because CustomPlayerBlueprint is a child actor of pawn.h. If CustomPLayerBlueprint is NOT a child of Pawn than the cast will always fail. Maybe the UE devs could look into making a note or something in the future for the cast to node to explain itâs function a little better.
Edit:
In your situation I see [Get Player Character] and a cast to SheilaTheFox. Let me ask you this one question: Is SheilaTheFox parent class Character.h? Iâm guessing itâs not? Good luck
âSheila the Foxâ is the blueprint class for the player character and stores the different movement nodes. So I used Get Player Character as an object of âSheila the Foxâ. That seemingly didnât work, but creating a variable which references to âSheila the Foxâ works fine.
Iâve tried something too similar than your case and for me works perfect.
a) Like âTheFoyerâ suggest check if is a class of Character in class settings
b) Make sure if âSheila the Foxâ is the Default Pawn Class
c) I expect âFoxSurfMenuâ is the right instanced widget and default value of âMountFoxGemExplorationâ is â0ââŚ
Anyway if I were you I change your goal sending a âmessageâ after collecting Gems, and you save a unnecessary check every tick, just for that case doesnât matter but at the end of the project sure you save resources and get better performance.
When making mods, there were a lot of Doonce conditions to ensure that everything was optimised.
I actually did away with Set Visibility and instead decided to change the text color of the buttons, depending on progress. Of course, such a thing only needs to be done once.
> âSheila the Foxâ is the blueprint class for the player character and stores the different movement nodes. So I used Get Player Character as an object of âSheila the Foxâ. That seemingly didnât work, but creating a variable which references to âSheila the Foxâ works fine.
That doesnât quite answer my question. If you open your blueprint in the top right you should see parent class. If this is your playerâs character then it should be of type âPawnâ. In that case you need to get âget player pawnâ node
change the cast to sheelaTheFox node to a pure cast. You use pure casts when you are NOT changing a variable inside the cast to node. You are getting a variable value, therefore you are not changing anything