Toggle visibility and change character
if you want two input events to fire when you press a button you could just disable consume input. this will allow many events to work from the same key press.
personally however your situation sounds to me like a good instance to use a interface. when you press space you call a interface event which will get triggered on every actor that implements the interface. so basically one script to affect all the things. you can even implement the interface in the level bp if you wanted. a major benefit of this approach is you only need a input event in one place which is good practice and makes for easier debugging later.
answered Oct 08 '18 at 01:46 PM
I would recommend moving the input event out of the level blueprint and into the player controller (use the same controller for both types of pawn).
As for choosing which objects are visible to each pawn, I'm not sure the best approach. The first idea is to set a Tag on each object as either "PawnTypeOneCanSee" or "PawnTypeTwoCanSee", and upon Possess event of the pawn class it can GetAllActorsWithTag for the one tag and set Hidden in Game to true on those, and GetAllActorsWithTag for the other tag and set Hidden in Game to false on them.
By using the Possess event then it does this at the point your playercontroller takes control of the other pawn.
But I think if there are a large number of objects to switch the visibility of, then this approach will cause the game to freeze every time you switch pawns, so I'm trying to think of a more efficient way that doesn't require you to set tags and loop through them, like maybe some special way of using materials or actor ownership (OnlyOwnerSee checkbox) or something, but I haven't come up with anything yet.
answered Nov 21 '18 at 04:57 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here