public override void OnInspectorGUI() { obj = target as RichText; base.OnInspectorGUI(); EditorGUILayout.ObjectField("图集:", obj.spriteFont, typeof(UnityEngine.Object), true, GUILayout.ExpandWidth(true)); if (GUILayout.Button("打印宽高")) { var size = obj.GetViewSize(); var scale = obj.canvas ? obj.canvas.transform.localScale : Vector3.one; Debug.LogFormat("size={0},scale = {1}", size, scale); } }