Should I be Spawning menu buttons?

I am having trouble figuring out how to create menus that are not always visible.

I have an actor that and I want a couple of buttons to appear around when it is touched. The problem is if I use Spawn Actor to create the buttons they will only have Prototype rules and cannot access the attributes of the scene. So for example, I want one of the buttons to draw a line between the selected actor and another actor in the scene. I can only do this with actors with instance rules, as far as I know, but I don't want the buttons to always be in the scene, only when the actor is selected.

Is there a general best practice for this type of feature?

Thanks!

Comments

  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
    keep them offscreen, and then change their x/y position when needed.

    I always create my scenes with some extra space at the top or side for buttons and stuff.
  • sambot13sambot13 Member Posts: 4
    Thanks for the tip. I've got this working by setting the alpha to 0. Any reason that is a bad idea?
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Alpha 0 is an effective way to hide buttons IF you're not worried about the player accidentally pressing them. If the button rules are active, you'll run into problems this way. A safer way is to move them, as @jonmulcahy mentioned. If you decide to hide them, make sure to have a boolean that turns your buttons off or else use When self.color.Alpha≠0 --> [behaviors].
Sign In or Register to comment.