Download

HowToCastToActorClassBlueprint..

I have tried almost everything. Even get all actors of class as the object pin and no matter what I do I cant seem to cast to a actor class blueprint? Does anyone know the answer to this?

what exactly are you trying to achieve, show us your BP.

Its very basic, I have a actor blueprint called secret. I collect the secret which sets a Boolean inside itself to true sayin collected and makes the secret mesh hidden.
I then get to the end level trigger and in the trigger blueprint I want to cast to the secret actor blueprint to get that Boolean and set another Boolean in my save game file to true.
The reason I want to do this in the end level trigger is because I don’t want the player to be able to collect the secret without completing the level.

I have searched the whole internet on unreal and nowhere ive seen does anyone ask about casting to an actor blueprint to get a variable. Maybe I’m doing something wrong.

For my other collectables I casted from the collectable to a variable in my player blueprint so it knows the amount. Then when I reached the end level trigger I casted to my player bp to get the collectable amount to check it against the full collectable amount in the level and then saved the collectables collected Boolean in my save game. This seems like a lott of casting and id rather just cast to the actor blueprint if it is at all possible.
Thanks for the quick reply

Classified. Mind your business.

It is really hard to help someone without an example. For all we know you’ve misunderstood a concept, are using a node in the wrong location, or almost anything else. If you are having this trouble in a ‘super secret project’, you could at least attempt to recreate the same scenario in a dummy project, or in an ‘unclassified’ area to show us what you’re currently doing. If you feel like this is going to make you look silly, don’t worry about it; We’ve all been there.

lol it was a joke. It is very basic I will show you a pic but it is as I said. I cant figure out what to put in object in order to get the variable from the cast.

Well, you need something to cast it. The “Object” Input for the Cast node is empty.
You probably want to load it from your SaveGame? You may also store it somewhere else, simply set your variable/bp variable to public and retrieve it just with a get node and plug it into the Object-input

I’m getting abit confused now. I don’t want to load it from the savegame yet. I have loaded the savegame slot here because once I get the secret collected variable from the cast. I will set it to the savegame variable. I’m just trying to pass information from the actor bp to the savegame bp through the end level bp I’m using now. I’m going to load from the savegame bp on the level selection screen where it shows the scores and also load it at the start of the level begin that its on so it hides the collectable once collected.
The variable save collected? is the variable I’m after and it is already public that’s how I’m getting it from the cast.
The thing that’s confusing me is, how can I cast to the variable I want and then plug it into the object if it hasn’t got an object to cast it in the first place?
Do you mean I should promote the actual secret blueprint to a variable then wire it into itself? Because doing that puts a note on the cast saying the variable is already itself so theres no need to cast to itself. Surely casting to an actor blueprint is the same in every instance and one thing should go into the object to get the variable from the blueprint that I need.

Where is your SecretBlueprint? In your Actor that enters the LevelEnd Collision?
If so, drag off the “Other Actor” from the Overlap Event and cast it to your Actor class that contains the SecretBlueprint. Then simply retrieve it with a get node.
Then you don’t need to cast to Secret BP anymore.

We don’t know your setup and don’t what you are actually trying to achieve.

The actor bp is just a spawned mesh in my level. it is just a secret collectable. My main character collects it, it sets a the Boolean secretcollected? inside itself.
How I set it up is I made a actor blueprint, put a mesh in it, made the mesh on overlap to hide itself and set the Boolean inside itself to true so I know its collected. I’m just trying to retrieve that variable from within.

This is the actor bp I’m casting to. You can see it is just a variable within an actor bp I put in my level.

I would show you it in the level but the file size is too big and its just a mesh anyway

All I need to do is know how to cast to an actor blueprint to get a variable. How do I know what to use as the object because nothing seems to work at all
I even tried cast to actor and using that to cast to the actor blueprint…

You might have to Click on the empty object pin on Cast to Secret Blue_Print and click make into a VARIABLE’.

you cant make the object pin a variable…This is stupid I’m sure its easy. This must be the same object for every actor blueprint you cast to

Anyone ever casted to an actor blueprint before from within an actor blueprint or were you too busy playing eyespy?

Why not make a variable on your player character called “SecretCollectible” that I’m assuming you’d want to overwrite on each level, perhaps? Then when you reach the secret collectible and overlap to pick it up, set it to the “SecretCollectible” variable so you have it stored for later. Then when you’ve reached the end of the level you can cast to it, using that variable as your reference node (the left pin on the cast you don’t have hooked up in the image you provided) and that way if the player’s got the secret collectible then your cast will succeed, otherwise it won’t.

Also, if you destroy the collectible when it’s collected then this probably won’t help you. So you will have to just hide it and disable collisions or something if necessary.

Note: You actually won’t even need to cast at all to the collectible if you just assign it to a variable when you first get to it. And you’ll still be able to get variable information from it by dragging a pin off the “get” reference node from it.