Using a multi-frame image for texturebuttons.

SslaxxSslaxx Posts: 8Member
edited December 1969 in GUI
So, I have a texturebutton, and I want to apply bits from an image - New_Game_Sprite_Sheet.png - for hover, click etc.<br /><br />However, I can't recall how to do this. Is anyone able to help, please?


  • arceonarceon Posts: 3Member
    Should be pretty straight forward:<br /><br />
      <br />[li]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[/li]<br />[li]load your image in the atlas texture setting[/li]<br />[li]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[/li]<br /><br />Hope this helps!
  • SslaxxSslaxx Posts: 8Member
    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: 8Member
    That's what I did. Thanks for confirming it's how to do it!
Sign In or Register to comment.