Hello,
I am not sure why the world UI action points are not getting updated after I press play, they update correctly for all the units only after I spend the first point.
public class UnitWorldUI : MonoBehaviour
{
[SerializeField] TextMeshProUGUI _actionPointsText;
[SerializeField] Unit _unit;
void Start()
{
Unit.OnAnyActionPointsChanged += Unit_OnAnyActionPointsChanged;
UpdateActionPointsText();
}
void Unit_OnAnyActionPointsChanged(object sender, EventArgs e)
{
Unit unit = sender as Unit;
Debug.Log($"{unit}'s action points have changed.");
UpdateActionPointsText();
}
void UpdateActionPointsText()
{
_actionPointsText.text = _unit.GetActionPoints().ToString();
Debug.Log("Points have been updated");
}
}
The debug does, however, show up in the console.