[0.16.2] GUI sprite-button not showing any sprites

This subforum contains all the issues which we already resolved.
User avatar
lovely_santa
Filter Inserter
Filter Inserter
Posts: 502
Joined: Sat Feb 18, 2017 9:41 pm
Contact:

[0.16.2] GUI sprite-button not showing any sprites

Post by lovely_santa »

Hello,

While updating my GUIs I came across this issue and no one in the discord server could find a solution, I even went as far as just implementing the example..
In the code below I add a sprite button to a frame to the top gui. As sprite path I just took the example as stated in the api of SpritePath:

Code: Select all

      local buttonDeaths = buttons.add{
        type = "sprite-button",
        name = "BZ_gui_buttonDeaths",
        sprite = "item/iron-plate"
      }
this code resulted in a functional button, but without a sprite (or just an empty one):
sprite-button.png
sprite-button.png (2.15 KiB) Viewed 1679 times
Am I just doiing it wrong?

EDIT: as 54758 states, it needs the style parameter, which is in conflict with the api of the LuaGuiElement saying it's optional. RSeding thinks its just broken, that it's not falling back to a default, so I left the bugreport in place...

Kind regards,
lovely_santa
You can find all my mods on the mod portal. Also helping on Arch666Angel's mods.
Image
Rseding91
Factorio Staff
Factorio Staff
Posts: 16044
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.16.2] GUI sprite-button not showing any sprites

Post by Rseding91 »

Thanks for the report. Style is optional but all that means is "if you don't give it, it won't error" In the case of the sprite button no style means it's mostly useless.

I changed the sprite button so it defaults to a style that should work for most cases.
If you want to get ahold of me I'm almost always on Discord.
kovarex
Factorio Staff
Factorio Staff
Posts: 8298
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: [0.16.2] GUI sprite-button not showing any sprites

Post by kovarex »

The solution also might be, that the sprite button is resized to the size of the sprite automatically unless it has specified size through script, in which case it would scale it.
User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5414
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: [0.16.2] GUI sprite-button not showing any sprites

Post by Klonan »

kovarex wrote:The solution also might be, that the sprite button is resized to the size of the sprite automatically unless it has specified size through script, in which case it would scale it.
I believe this is intuitive behaviour, often have i had this problem where the custom 'sprite' widget already does this
Post Reply

Return to “Resolved Problems and Bugs”