Hi there,
I've successfully created a custom action to change a menu element font and font size but I can't succeed in changing font color.
This is my script:
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif
namespace AC
{
[System.Serializable]
public class ActionChangeFontColor : Action
{
// Declare variables here
public string MenuName;
public string ElementName;
public Color MyFontColor;
public ActionChangeFontColor()
{
this.isDisplayed = true;
category = ActionCategory.Menu;
title = "Change Menu Font Color";
description = "Change Menu Font color";
}
override public float Run()
{
AC.PlayerMenus.GetElementWithName(MenuName, ElementName).fontColor = MyFontColor;
return 0f;
}
#if UNITY_EDITOR
override public void ShowGUI()
{
// Action-specific Inspector GUI code here
MenuName = EditorGUILayout.TextField("Menu name:", MenuName);
ElementName = EditorGUILayout.TextField("Element name:", ElementName);
MyFontColor = EditorGUILayout.ColorField("Font Color:", MyFontColor);
AfterRunningOption();
}
#endif
}
}
no matter which color I choose, the text stops appearing.
What am I doing wrong?
Thanks!
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
The code looks correct - does the new colour have its alpha set to 1?
I'm an idiot...
Thanks and sorry for bothering!