Simple question how to cast to another BP from a level BP

Any idea on how to cast from a level Blueprint to a normal Blueprint?

It can't be a **'cast to class'** because I want to access some variables,

And it can't be that individual Instance because I will be having multiple instances of that Blueprint,

All what's needed is to access and change the Class Default so that the instances will inherit that Data

Spawned from class dynamically

its spawned by the level Blueprint

cast to another BP

What is that blueprint?

  • placed in the level manually
  • or spawned from class dynamically

its spawned at a Specific world location and moves from that axis

Oops sorry… I said it wrong it was not spawn actor

How it works is that I load a level instance
And in that level is a blueprint amongst the other items
so I cant just spawn it there because its in that level

well this did not turn out so simple
Over all overview

  • This game is a Sidescroller

  • As you run it loads levels ahead of you and unloads behind you

  • It uses the Level Blueprint in order to do that

  • The Thing is I want to access the variable that has the speed rate so as you go on the speed increases

  • but I can’t access it because it does not exist at the moment

  • and I tried doing that but it only did it on that Individual one

  • So What’s needed is to change the original actor’s property so that the instances will inherit from that original actor

In the return value node you can promote to variable . this way if its in the game mode(for instance) you can always access that class via the game mode. For instance spawning a hud or widget and then you promote it to a variable when next you want to add it to viewport you don’t need to use crate widget but simply get that variable and then add it to viewport. Hope this helped. Let me know if my description wasn’t clear enough on . Hope this helped

If it’s spawned dynamically by the LB, you already have the reference (return value) and there’s nothing to cast… It’s an actor with the correct type already.

332504-screenshot-3.jpg


So what exactly are you trying to do.

I want to access some variables,

The LB needs to know variables of the actor, sure - right click the Return Value pin and promote to variable - that’s the hard actor reference now. You can use it as is, no need to cast.

All what’s needed is to access and
change the root Data so that the
instances will inherit that Data

Not sure what that means. What’s root data? Class Default?


But I feel I’m missing the point. Consider describing the end result. No idea why the question is about casting in the first place, there’s no casting needed here.

I am really sorry, but I don’t understand the intent or setup.

What exactly is stopping you from dragging the reference to the Level Blueprint?


Alternatively, select it in the Outliner and right click in the graph to create a reference:

Still, no casting. I feel like I’m missing something, though.

That’s whole point of the Level Blueprint.

The Thing is I want to access the
variable that has the speed rate so as
you go on the speed increases

Is this like a power up that the player runs into? Or an effect of that entire level? So there’s an actor in the level and this actor needs to send the data to who, the player? Or to some other actors - are those actors in this level? This is so confusing.

So What’s needed is to change the
original actor’s property so that the
instances will inherit from that
original actor

I don’t get it, sorry.

The Thing is I want to access the
variable that has the speed rate so as
you go on the speed increases

But again, who needs to access that variable, the player?!

To keep it simple, every blueprint class when being spawned can be promoted to a variable even widgets. I do what your describing by promoting what is spawned to a variable(object reference variable). This way if it was spawned through the game mode or instance (preferably game instance so it is accessible in all levels till you restart your app) you just need to cast to game instance , then get the variable(of spawned object ex character), then from that you can get your value. I’ll add a screenshot that i feel is the simplest implementation of this. I add my HUDs through my game mode and whenever i want to access their variables on whatever level i am i just call it from there.

. Jut check game instances it exists even if the level is reset, until the game exits.

332524-simple.png