Hmm, well I don’t know what that plugin is, but if the cast is failing then the reference must be wrong. You could try getting all actors from the VaRest BP, and as that, cast to it.
I tried installing the plugin to try myself but I couldn’t figure it out…
If the cast isn’t firing then the reference is wrong. You should try what I mentioned and casting to the BP you’re casting to. I have no idea if this is the “correct” way to do it, it’s just how I’d do it.
I made this real quick to show you what I mean (When I press button, it call the event in a separate actor class):
i still don’t really understand casting. I’m following the “endless runner” video tutorial and he uses it a lot, and when he does use it, I feel like I get it, but if I try to do it in something i make myself I’m just like, wtf, how does this even work? xD
I have read the documentation about it but if anyone could explain it in more detail including when it should be used and when not to use it, that would be great
I just want to keep certain events and functions organized in a blueprint I can call later. Casting should let me call those events easily whenever I want. Most of the video tutorials I’ve seen cover how to Get/Set variables. But I just want to call “events”.
Chances are there’s an easier way I don’t see yet (Blueprint Interfaces?)
This MSC variable, you will need to assign a value to it before you can obtain any results from calling it. Think of the variable as an empty house, and of any one instance of your MSC blueprint class as person.
When you call an event from the variable, you are actually knocking at this house (the variable)'s door. If there is no person (the instance of your MSC class) living in it, no one will answer the door :). When you assign a person to live in the house, he or she will answer your call.
I see you try to call the MSC variable from a Widget Blueprint. Try this. Open your level and create an actor of the MSC class anywhere. Then go to your Level Blueprint, and, on Begin Play, assign the actor you just created to the MSC variable in your Widget Blueprint. Then see if it works.
Your problem is that your variable MSC inside Splash_Side_Menu is never set.
The easiest way to set it is when you create the widget, you almost have it.
I’m assuming MSC is a blueprint in the world somewhere so you can get a reference in the level blueprint. If not you will have to use the get all actors of class after it has been spawned like has already worked for you.
Select MSC in your level then open your level blueprint, right click and create a reference.
Now on the Return Value on Create Splash_Side_Menu drag off and get a set MSC. Then connect your MSC reference to the set.
This gets the MSC from the world and sets the MSC variable inside Splash_Side_Menu to reference it.
Now in Splash_Side_Menu you don’t need to cast or anything simply drag MSC onto your event graph and drag off it get custom function, then connect to button.