Problem with casting
I do not understand why this is not working as it should. I am trying to create a jump pick up so whenever the player (which is a vehicle pawn/Sedan blueprint) runs over said pick up they obtain the ability to jump permanently. I am having a problem with casting the USB pick up blueprint to the Sedan blueprint. IMG_A is the Sedan blueprint. If integer Pickedup (part of the cast) is more than or equal to 1 the branch will carry out the process.
In IMG_B Pickedup IS set to one. I did a test in which if Pickedup was 1 a text would print. When I run over the pick up in game, the text appears clarifying that the integer is set to one but the jumping does not work.
My question here is why isn't the Sedan blueprint not recognizing that Pickedup has been set to one but the USB blueprint does?? WITHOUT the cast, the jump function works PERFECTLY FINE. With the cast it does not. Is my object wild card wrong? (I am a bit confused when it comes to the referencing of things)
asked Nov 15 '18 at 01:18 AM in Blueprint Scripting
I FIGURED IT OUT YES! I scratched the INT and set a Boolean called IsUSBPicked as untrue as its default inside the sedan. In USB blueprint I did a cast to sedan and set Boolean as to true. THIS fixed my problem. I needed to set the variable inside the sedan rather than the USB blueprint. Also your comment gave me advice to further help me on this. Thank you so much for helping me!
answered Nov 15 '18 at 02:18 PM
Do both the USB and the sedan have a Jump enabled variable? Casting doesnt give variables it just tells the blueprint to treat that actor as that class. If the actor is not a child or parent of that class type then the cast will fail.
answered Nov 15 '18 at 02:30 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here