Set variable by using Cast to Actor ?

is there any way to set a variable for another blueprint without knowing what is the actor blueprint name ? for example i can set a variable with casting objects to their blueprint name , but i can set that variable with using “cast to actor”.

i need that because i have a lot of actors with different blueprints but with some common variables , and it will be so hard to set them one by one. is there any procedural way to fix this problem ?

thanks

yes there is…

implement an interface for your actors to communicate with.

The way you describe it, screams for an interface, but your wish to cast to Actor wont do the magic.

Instead Create an Interface.
Add Functions to that interface -> bool GetCondStart/SetCondStart(value);

each actor with those values should now implement this interface.
This forces you to implement the interface functions inside your blueprint.

you will return or set your variables via those functions.

Now when you want to access them instead of casting to a specific bp or actor, call those interface functions.

Thank you so much , it works now

When you cast to an actor, you can only access things that are common for all actors. If you have a few blueprints that you know you want to ask have something in common. You can make a base blueprint and then make child blueprints from that.

All actors that inherit from that base blueprint will have those properties and will be accessible through a cast.

thank you dude , nice tip , i will check this