public bool DoesOverlap(MultiSelectType testType) { int targetMask = testType.selections; int contactMask = selections & targetMask; #region DebugHelper //Debug.Log("Current Mask__" + ToBits(selections) + "\n" + // "Target Mask__" + ToBits(targetMask) + "\n" + // "Contact Result__" + ToBits(contactMask)); #endregion return(contactMask != 0); }
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { const string selectionsName = "selections"; SerializedProperty selectionsProp = property.FindPropertyRelative(selectionsName); Rect namePos = position; float halfWidth = namePos.width / 2; namePos.width = halfWidth; Rect maskPos = EditorExtentions.MoveRectRight(halfWidth, namePos); EditorGUI.LabelField(namePos, property.displayName); Object target = property.serializedObject.targetObject; System.Object val = fieldInfo.GetValue(target); MultiSelectType actualObj = (MultiSelectType)val; selectionsProp.intValue = EditorGUI.MaskField(maskPos, selectionsProp.intValue, actualObj.possiblities); }