窗口基类 public class WindowRoot:MonoBehaviour { private string currentClassName; public WindowRoot() { currentClassName = this.GetType().Name; } public virtual void InitWindow() { Debug.Log("初始化"+currentClassName+"..."); } }
继承的子类
public class A : WindowRoot { // Start is called before the first frame update void Start() { InitWindow(); } // Update is called once per frame void Update() { } }
打印 (初始化A...)