public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { EditorGUI.BeginProperty(position, label, property); position = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), label); SerializedProperty valueProperty = property.FindPropertyRelative("_value"); SerializedProperty tagLibraryProperty = property.FindPropertyRelative("_tagLibrary"); position.height = 16; tagLibraryProperty.objectReferenceValue = EditorGUI.ObjectField(position, tagLibraryProperty.objectReferenceValue, typeof(ImpactTagLibraryBase), false); position.y += 18; position.height = 16; ImpactTagLibraryBase tagLibrary = tagLibraryProperty.objectReferenceValue as ImpactTagLibraryBase; if (tagLibrary != null) { ImpactTagNameList tagNames = new ImpactTagNameList(ImpactTagLibraryConstants.TagCount); ImpactEditorUtilities.GetTagNames(tagLibrary, ref tagNames); ImpactEditorUtilities.TagDropdown(property, valueProperty, tagNames, position); } else { valueProperty.intValue = EditorGUI.IntField(position, valueProperty.intValue); } EditorGUI.EndProperty(); }
/// <summary> /// Creates a new tag mask from the given bitmask. /// </summary> /// <param name="maskValue">The original bitmask.</param> /// <param name="tagLibrary">The tag library that was used to create this mask.</param> public ImpactTagMask(int maskValue, ImpactTagLibraryBase tagLibrary) { _value = maskValue; _tagLibrary = tagLibrary; }
/// <summary> /// Creates a new tag from the given tag value. /// </summary> /// <param name="tagValue">The original tag value.</param> /// <param name="tagLibrary">The tag library that was used to create this tag.</param> public ImpactTag(int tagValue, ImpactTagLibraryBase tagLibrary) { _value = tagValue; _tagLibrary = tagLibrary; }