I have a class extending Toggle and I imply need to reference the name of that Toggle as used in the editor Most of the answers from a google search assume you are dynamically instantiating the Toggle. I am not. Code (csharp): using System.Collections; using System.Collections.Generic; using System.Linq; public class PointerDownToggle : Toggle { public override void OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData) { } public override void OnPointerDown (UnityEngine.EventSystems.PointerEventData eventData) { base.OnPointerClick (eventData); group.NotifyToggleOn(this); //doesn't work since Toggle doesn't extend Monobehavior! Debug.Log("ASSERT this.name = "+ this.name); } }
Check out .GetType()... I think that gives you what you want: Code (csharp): Debug.Log( GetType() + ".OnPointerDown();");