Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: SilverbackLuke 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.
-
Hi.
Yes its possible.
I had to look on my Third party asset actions for PlayMaker (http://u3d.as/1kig) 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
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;
}
}
}
-
That worked great! Thank you!