I'm coding a simple maze game in UE4 and I have everything I wanted to implement done except having an obstacle in the scene. What I have is a simple Obstacle
class which is a child of an Actor
class.
Now in the scene I have a Blueprint
which is a child of the Obstacle
class and this Blueprint
is placed in the maze. What I'm trying to achieve is when the player collects so many objects (let's say 10) then the Obstacle
will be destroyed but I don't know how to get a reference to that Obstacle
object in my code.
AObstacle* Obstacle /////// This is where I don't know how to initialize the object
if (MyCharacter->collectedPickUps >= requiredAmountOfPickups)
{
Obstacle->Destroy();
Obstacle->isActive = false;
}