playMaker

Author Topic: Custom Category Icons  (Read 260 times)

SilverbackLuke

  • Playmaker Newbie
  • *
  • Posts: 2
Custom Category Icons
« on: May 18, 2021, 09:11:55 AM »
This may or not be possible, but is there a way for me to define a custom icon for any of my custom categories?

When I create custom actions and place them inside a new category, it would be nice for me to also define an icon to render for that category.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 6606
    • jinxtergames
Re: Custom Category Icons
« Reply #1 on: May 18, 2021, 10:51:31 AM »
Hi.
Yes its possible.

I had to look on my Third party asset actions for PlayMaker asset as i forgot how to :)

You need to set the script in an editor folder and the icon in a resources folder

Here is a sample script from the Debug Extension Action Category

Code: [Select]
using UnityEditor;
using HutongGames.PlayMakerEditor;
using UnityEngine;

[InitializeOnLoad]
public class DebEx_Icon : MonoBehaviour {

    static DebEx_Icon()
    {
        #region CategoryList

        Actions.AddCategoryIcon("Debug Extention", DebugExtentionActionIcon);
        #endregion
    }

    private static Texture sDebugExtentionActionIcon = null;
    internal static Texture DebugExtentionActionIcon
    {
        get
        {
            if (sDebugExtentionActionIcon == null)
                sDebugExtentionActionIcon = Resources.Load<Texture>("DebEx_Icon Image");
            ;
            if (sDebugExtentionActionIcon != null)
                sDebugExtentionActionIcon.hideFlags = HideFlags.DontSaveInEditor;
            return sDebugExtentionActionIcon;
        }
    }
}
Ecosystem might not work at the moment
here are direct Github Links to the custom actions :
https://github.com/PlayMakerEcosystem
https://github.com/jeanfabre


Join the PlayMaker Discord Channel!

SilverbackLuke

  • Playmaker Newbie
  • *
  • Posts: 2
Re: Custom Category Icons
« Reply #2 on: May 18, 2021, 02:47:49 PM »
That worked great! Thank you!