public static void toggle2Inspector(UIToggle2 aToggle) { Rect bounds = EditorGUILayout.RectField("Bounds", aToggle.bounds); if (aToggle.debug == true) { GUI.enabled = false; EditorGUILayout.RectField("Scaled Bounds", aToggle.scaledBounds); GUI.enabled = true; } aToggle.uniformScale = EditorGUILayout.Toggle("Uniform scale", aToggle.uniformScale); if (aToggle.uniformScale == false) { aToggle.scale = EditorGUILayout.Vector2Field("Scale", aToggle.scale); } else { Vector2 scale = aToggle.scale; scale.x = EditorGUILayout.FloatField("Scale", aToggle.scale.x); aToggle.scale = scale; } aToggle.setBounds(bounds.x, bounds.y, bounds.width, bounds.height); }
bool toggleHitTest(out UIToggle2 aToggle) { aToggle = null; for (int i = 0; i < m_Toggles.Count; i++) { if (m_Toggles[i].GetType().IsSubclassOf(typeof(UIToggle2)) == false) { continue; } UIToggle2 toggle = (UIToggle2)m_Toggles[i]; if (toggle.hitTest()) { aToggle = toggle; return true; } } return false; }