Search Unity

Question Sliding cursor over multiple buttons to active them.

Discussion in 'UGUI & TextMesh Pro' started by josephbauerly, Feb 28, 2023.

  1. josephbauerly

    josephbauerly

    Joined:
    Jun 13, 2019
    Posts:
    2
    Hello, all. I'm trying to code a functioning piano keyboard in my 2D game right now. I'd like to be able to hold down Mouse0 and drag my cursor across several keys and have them all activate as my cursor passes over them. I pretty much want it to work exactly as the online keyboard works at https://www.onlinepianist.com/virtual-piano.

    Can this be accomplished in the UI with separate buttons for each of the piano keys? Right now clicking and holding Mouse0 but dragging the cursor does nothing to any buttons other than the first one the click began on. Perhaps it's impossible to do this with UI buttons and I need to code the keys as game objects. I'm not sure.

    Please let me know if you need clarification as to what I'm asking for. I fear I may have explained insufficiently.

    Thanks!
     
  2. josephbauerly

    josephbauerly

    Joined:
    Jun 13, 2019
    Posts:
    2
    Figured it out. If anyone really wants to find out how I did it I may be able to explain my method. No guarantees, though.

    Sorry for the zero net information post.