private static void DisplayHelpInfo(FieldInfo fieldInfo, object targetObject)
        {
            Type targetType = targetObject.GetType();

            DynamicHelpAttribute dynamicHelp = GetAttribute <DynamicHelpAttribute>(fieldInfo);
            HelpAttribute        helpInfo;

            if (dynamicHelp != null)
            {
                MethodInfo checkingFunction =
                    targetType.GetMethod(dynamicHelp.CheckingFunction);
                helpInfo =
                    (HelpAttribute)checkingFunction.Invoke(
                        targetObject, new object[] { });
            }
            else
            {
                helpInfo = GetAttribute <HelpAttribute>(fieldInfo);
            }

            if (helpInfo != null)
            {
                MessageType messageType =
                    (MessageType)Enum.Parse(typeof(MessageType), helpInfo.MessageType.ToString());
                EditorGUILayout.HelpBox(helpInfo.HelpMessage, messageType);
                GUILayout.Space(EditorGUIUtility.standardVerticalSpacing);
            }
        }
コード例 #2
0
        /// <summary>
        /// Get the underlying <see cref="HelpAttribute"/> of this drawer.
        /// </summary>
        /// <param name="property">The target SerializedProperty.</param>
        /// <returns>The HelpAttribute of the given property. It could be null based on
        /// the condition function.</returns>
        protected override HelpAttribute GetHelpAttribute(SerializedProperty property)
        {
            DynamicHelpAttribute dynamicHelpAttribute = attribute as DynamicHelpAttribute;
            Type       targetType       = property.serializedObject.targetObject.GetType();
            MethodInfo checkingFunction =
                targetType.GetMethod(dynamicHelpAttribute.CheckingFunction);
            HelpAttribute helpAttribute = (HelpAttribute)checkingFunction.Invoke(
                property.serializedObject.targetObject,
                new object[] { });

            return(helpAttribute);
        }