Toggle Visibility of meshes when shooting

Hi everyone,

I am working on a VR game where the player can teleport himself to different locations by pointing with the controler on them. I have set up one BP called “spawnlocation” which has only a static mesh and i can change the material. I want those spawnlocations to be only visible when the player is pushing the trigger and when the trigger is released I want the spawnlocations to be invisible again.
I have created a boolean variable in the player character called “isShooting” which i edit when the trigger is pressed. Now the spawnlocation BP should check if this variable is true and then i want to toggle the visibility. The isShooting variable is set to global but somehow i cant manage to toggle the visiblity.
I have searched the complete internet for an answer but somehow I cant find anything useful :frowning: or I cant undestand something…
Can you guys help?



You need a reference of your character in the SpawnLcation blueprint. When you spawn the SpawnLocation blueprint, set the owner to your Character. Then in your SpawnLocation BP you can use the GetOwner node and cast it to your character.

Please watch the following video for more about Blueprint Communication.

Thank you @Azarus for your fast reply. I’m quite new to programming with the Unreal so my question is how can I set the owner of a BP?
I have followed the tutorial and this is my result: c7e945c913aa837b1e1b5e25d45fa7675ca5cec2.jpeg

But my question is: Is there a more elegant way to achieve this? If I insert now another spawnlocation I have to link it in the LevelBP. Is there a way around it?

Here are the nodes to set the owner.

But you can use the getAl Actors of Class and Toggle the Visibility for the actors like this:

So you don’t need a level blueprint at all, you can set it in your character bp.

Woot everything is working!!! XD

I have deleted all from my levelBP and used the get all actors of class to toggle all my spawnpoints.
Here is the complete charakter BP:fe259c1bfd69ea6fbfb53e15f679ce8f63e327d2.jpeg
@Azarus, you are my hero. You saved me from hundrets of work digging through the internet for the rest of my lifetime hunting for a solution XD