Using a multi-frame image for texturebuttons.

SslaxxSslaxx Posts: 7Member
edited December 1969 in GUI
So, I have a texturebutton, and I want to apply bits from an image - - for hover, click etc.

However, I can't recall how to do this. Is anyone able to help, please?

Comments

  • arceonarceon Posts: 3Member
    Should be pretty straight forward:

    • add a new AtlasTexture to your button's appropriate action ("TextureButton" -> "Textures" in the inspector), then select "Edit..." in the drop-down menu for the added atlas
    • load your image in the atlas texture setting
    • assign the region for this particular button action on that atlas image (for your case, I'd suppose it's x:0 y:0 w:360 h:50 for the first, normal, button in your image) and do so for other actions changing the region values as necessary
    Hope this helps!
  • SslaxxSslaxx Posts: 7Member
    So, I imported the image as an atlas texture. But if I, say, set the normal image for the button as [1,1,350,50] and then the pressed button as [1,102,350,50] it changes the normal button's image as well. Clearly, I am lacking some understanding of how this works. Can anyone enlighten me? And yeah, I know I'm almost certainly doing this in an over-wrought fashion (just having the buttons as separate image files would work better), but humour me here as I'm interested in learning how this works.
  • arceonarceon Posts: 3Member
    You have to set a new atlas texture for each button action then load your atlas image (again, for each action) and then set the region for that button action.
  • SslaxxSslaxx Posts: 7Member
    That's what I did. Thanks for confirming it's how to do it!
Sign In or Register to comment.