-2

I like to invisible/hide a cube when the charactar go in a triggerbox and press a Key like "E". I have already open a blueprint and insert a triggerbox and linked with the Key "E". But I don“t know how I can get the cube (in the world the triggerbox and the cube are far away), also in the blueprint. I hope you can help me.

Strecki

Strecki
  • 19
  • 1
  • 6

2 Answers2

1

It's better practice to not use GetAllActorsOfClass if you can, have the box register it's self in a tag on it's BeginPlay, then you can cast it to the player and set it in an array on your character. Then you can call the box inside your character blueprint and set visibility there. It'll all be handled when the game loads up instead of looking up all actors in the middle of the game, which can get heavy if you have a bunch of actors to go through every time you need the action to fire. This way you call on the specific actor when needed and not need to look up all actors over and over.

Glenn
  • 79
  • 1
  • 10
0

In your Trigger Blueprint:

  • call the node "GetAllActorsOfClass" once your character steps into (overlaps with) it
  • select your Cube Blueprint (if you haven't created one already, do so)

you will end up with an array of all the cubes you've placed in the world. Now simply get the one you need and call "SetActorHiddenInGame".

These links might help:

SetActorHiddenInGame

Find Actor