Make answer blocks buttons

Guys!!! OMG OMG OMG. I’m pretty psyched bc when I was thinking about some sort of app store preview, I realized that it would be better if the answer blocks were buttons and were shaded when you pressed them.

Sooo I quickly whipped that up in my app, used the prefab, and then made the necessary alterations!

  • made a button the size I wanted (155×53 in Unity width/height, but there’s some scaling stuff going on from being a child of other stuff … honestly I’m not super sure I understand this but I’m at least writing what I did)
  • used the source image AnswerBlock190x88 (unsure if this is necessary)
  • in Button Script, made the pressed color darker (A9A9A9FF)
  • The button is childed to each number instance under Answers. Text is a separate child (This may be wrong, but I wanted to keep using my textmesh script … should probably make this simpler at some point #todo)
  • Then, I put the entire Answers chunk under Canvas (it won’t show up unless you do that, since it’s UI entities)
  • Changed z numbers to the following:
    • Answers: 0
    • Button: -1 (as long as it’s a lower number than Text, it will hide the Text)
    • Text: 0

Leave a Reply

Your email address will not be published. Required fields are marked *