access a variable from level blueprint in unreal engine 4

Ilyas Ennaboulsi picture Ilyas Ennaboulsi · Jun 4, 2018 · Viewed 11.6k times · Source

I Have a variable that updates every time i move my cube in the level blueprint , now i want to access this variable from multiple class blueprints , what do I do , I tried casting to gamestate but didn't succeed , I am really new to ue4 if you could explain in details please

edit: sorry for not adding details , The var I want to access is an integer named cube_side that tells me what side the cube is on every time I move , all of this happens in the level bp , I want to access this variable to see what side the cube is on from other class blueprints -> here are some details in a picture

I know it's not good to code everything in the level blueprint , but it's too late now , I only need to transfer the var cube_side to other class blueprints so the other object can change depending what side the cube is on.

Answer

Brian picture Brian · Aug 25, 2018

Create an Actor Class for your logic/functionality. Then use Get all actors of class (choose your class) -> Get a copy -> get variable

enter image description here enter image description here