Gate blueprint logic in c++

I have a problem on how to implement a gate in c++. Is it normal to put gate logic inside the tick function of an actor?

I want to (spawn and) move a building as long as the player does not pressed the left click again the building should be moved to the location of the mouse. I was thinking of something like this:

  1. Button sends signal to player pawn (with mesh to build)
  2. function which was bind to the “build” signal triggers
  3. the function will spawn the actor and place a reference into a variable
  4. if the left mouse button is clicked place actor and delete reference within variable ← *this would be triggered each time the left mouse button was pressed *
  5. if the variable is not empty → update actor location to mouse position ← this would be the line within the tick function of the player pawn

Is there a better way of doing it or lets say a relativly official way?

I think the way you described is fine. I would simply try it out and see if it works, and then later you can improve it if you see performance becoming an issue.

It’s very easy to get caught in the trap of “Let me plan this feature/system down to the most minute detail before I write any code”, when often times the things you think will be issues - aren’t, and the things you didn’t see coming a mile away are. :slight_smile: