A downloadable extension

Download NowName your own price

Quick links: source code

This small extension allows you to dynamically change window icon (also seen in taskbar) and taskbar badges (commonly used for notifications and such) in your GameMaker games.

Functions (GameMaker):

  • window_set_icon(path_to_ico)
    Changes the window icon. Path should point to a valid ICO file.
  • window_set_icon_buffer(buffer_with_an_ico_inside)
    Changes the window icon. The buffer should contain a valid ICO file.
  • window_set_icon_surface(surface, set_big_icon)
    Changes the window icon to match the pixels in a surface.
    "big" (32x32) icon may used for display in taskbar.
  • window_reset_icon()
    Resets the window icon to whatever it was on game start.
  • window_set_overlay_icon(path_to_ico, ?description)
    Changes the little overlay/notification badge icon shown in the corner of the window. Path should point to a valid ICO file.
  • window_set_overlay_icon_buffer(buffer_with_an_ico_inside, ?description)
    Changes the little overlay/notification badge icon shown in the corner of the taskbar button. The buffer should contain a valid ICO file.
  • window_set_overlay_icon_surface(surface, ?description)
    Changes the little overlay/notification badge icon shown in the corner of the taskbar button to match pixels in a surface.
  • window_reset_overlay_icon()
    Resets/removes the little overlay/notification badge icon.

Functions (C#):

  • WindowIconTools.SetIcon(texture2d or null, kind)
    Changes small or big icon for the window to match the given texture with format=BGRA32.
    In non-Unity C#, you provide an array of bgra bytes, width, and height instead of a texture.
  • WindowIconTools.SetOverlayIcon(texture2d or null, opt. description)
    Changes the overlay icon in the taskbar.
  • WindowIconTools.SetProgress(progressState, numCompleted, numTotal)
    This is an equivalent of the other extension I made and is only here because it didn't really "cost" anything to add.

So, for example, if you had a "some.ico" in your Included Files, you could do

window_set_icon("some.ico");

Have fun !

Download

Download NowName your own price

Click download now to get access to the following files:

window_set_icon.gmez 41 kB
window_set_icon.yymp 49 kB
WindowIconToolsUnity.unitypackage 2 kB
WindowIconTools.cs 10 kB

Development log

Comments

Log in with itch.io to leave a comment.

Do you know if this works on Mac?

(+1)

It does not. You would need to write a DyLib for that, this might be a clue if Apple didn't change API since then.

Feel free to send a PR if you manage to figure it out! Someone else said that they were looking into making this work with Linux.

This is super helpful! Thank you very much. Came from reddit, this is exactly what I needed!

On another note, do you know how to create a texture with the BGRA32 format? I can't seem to get one working in Unity, and converting it doesn't seem to be much use either. The progress bar is extremely useful though!

(1 edit) (+1)

For whatever reason you can't set a texture to import as BGRA, but you can create a new texture in BGRA format and carry over the pixels to it, like so (also seen in test project on git):

Texture2D ConvertTexture(Texture2D texture, TextureFormat format) {
    var tex = new Texture2D(texture.width, texture.height, format, false);
    tex.SetPixels32(texture.GetPixels32());
    return tex;
}

Thank you!

(+1)

Thank you this is great!