Possess an actor of a level by clicking a button in the menu

Hi. I’m having this problem. I have two different characters made, one for walking the level (has movement, jump, etc.) and one for cameras (is only a camera fixed and can’t move). I have 12 actors who run this last character.

I know how to posess every actor from keyboard shortcuts in the level blueprint. I have a widget who pauses the game and opens a menu with lot of options. What I want is to configure 13 (1+12) buttons, whose function is possess each of the specific actors. But I can’t do what shows in the picture, because when I save, an error says that "graph is linked to object world in external map.

What are my options? I think is something about creating variables in the Game Instance and casting them, but I have no idea of the steps to follow and I dont find any tutorial for this. Thank you.

If you are not streaming the levels then you could just have a begin play event (or in the case of widgets construct) where you “get actor of class” and pick the specific camera and assign it to a variable as reference and then just just that variable in posses.

1 Like

I think this is the solution, and know it must be easy, but I don’t know how to create that variable and asign every camera to that variable. Can you extend that part of the explanation like if I were a kid?

You can have a soft object reference to the actor, and use that to possess it. Soft references are by name, and will only resolve to an actual object if the referenced object is found and loaded. When you select a soft object pointer variable in your blueprint, you will get a dropdown with all available actors in your currently loaded level that you can pick from

It’s not the best solution because it can break if you rename actors or the level, but it will work for you for now

2 Likes

A quick example I cooked up

Oh and use the number keys to switch through cams an click on buttons :stuck_out_tongue:
Last number on the scale retuns to character

2 Likes

Thank you! I will try first the soft object reference first for having something working and I will try after your solution. Is what I was looking for, and I need to merge it with the project :smile:

Sorry for bothering you, but I can’t manage to adapt what your did to my project. It’s funny but is too complex and I don’t understand the logic. I follow all the steps and get stuck because I already have the buttons, and in your example they generates by loop and references itselfs. I only want to say to the program that by clicking certain button, he will possess the camera actor. I don’t know why I cant’ understand this basic, but I cannot. Thanks