Sprite Overlays – best way?

Home Forums Books Unity 3D UI Essentials Sprite Overlays – best way?

Viewing 1 post (of 1 total)
  • Author
  • #10472

    I’m working on some code to manage a character selection grid, currently I’ve set up a character slot prefab that is basically structured as :

    SlotBackground -> a plain tile sprite – this is full alpha and is always drawn
    Character Image or Blocked Tile Image – sprite this is a partial alpha image and is drawn depending on whether a character is in the slot or the slot is blocked
    BackgroundOverlay – sprite only drawn on certain slots to show they need to be filled by a particular character type.
    Stats Overlay – drawn when a character is in the slot, show level and hiring cost as 2 text components.

    I’ve kind of got it to work how I want, but I can’t help but feel it’s a bit clumsy and overly complicated…

    For the various overlays to work as overlays I’ve had to set the colour component of their script to be white, but if there is no sprite assigned to the image then unity draws the box as just a white square. If I do assign an image then it works correctly with the partially alpha’ed image appearing over the background, but to get this to work i’ve had to programatically flip the color between white and full alpha depending on wether the slot is ‘occupied’.
    As slots are never occupied in the editor this also means that the editor shows ugly white blocks only

    Has anyone done anything similar, or offer some advice how to stucture his a little better?




Viewing 1 post (of 1 total)
  • The forum ‘Unity 3D UI Essentials’ is closed to new topics and replies.