GetScriptTypeWasJustCreatedFromComponentMenu() private method

private GetScriptTypeWasJustCreatedFromComponentMenu ( ) : bool
return bool
コード例 #1
0
        public bool MissingMonoBehaviourGUI()
        {
            serializedObject.Update();
            SerializedProperty scriptProperty = serializedObject.FindProperty("m_Script");

            if (scriptProperty == null)
            {
                return(false);
            }

            EditorGUILayout.PropertyField(scriptProperty);

            MonoScript targetScript      = scriptProperty.objectReferenceValue as MonoScript;
            bool       showScriptWarning = true;

            if (targetScript != null && targetScript.GetScriptTypeWasJustCreatedFromComponentMenu())
            {
                showScriptWarning = false;
            }

            if (showScriptWarning)
            {
                GUIContent c = EditorGUIUtility.TrTextContent("The associated script can not be loaded.\nPlease fix any compile errors\nand assign a valid script.");
                EditorGUILayout.HelpBox(c.text, MessageType.Warning, true);
            }

            if (serializedObject.ApplyModifiedProperties())
            {
                EditorUtility.ForceRebuildInspectors();
            }

            return(true);
        }
コード例 #2
0
        public bool MissingMonoBehaviourGUI()
        {
            base.serializedObject.Update();
            SerializedProperty property = base.serializedObject.FindProperty("m_Script");

            if (property == null)
            {
                return(false);
            }
            EditorGUILayout.PropertyField(property, new GUILayoutOption[0]);
            MonoScript objectReferenceValue = property.objectReferenceValue as MonoScript;
            bool       flag2 = true;

            if ((objectReferenceValue != null) && objectReferenceValue.GetScriptTypeWasJustCreatedFromComponentMenu())
            {
                flag2 = false;
            }
            if (flag2)
            {
                EditorGUILayout.HelpBox(EditorGUIUtility.TextContent("The associated script can not be loaded.\nPlease fix any compile errors\nand assign a valid script.").text, MessageType.Warning, true);
            }
            if (base.serializedObject.ApplyModifiedProperties())
            {
                EditorUtility.ForceRebuildInspectors();
            }
            return(true);
        }
コード例 #3
0
        public bool MissingMonoBehaviourGUI()
        {
            base.serializedObject.Update();
            SerializedProperty serializedProperty = base.serializedObject.FindProperty("m_Script");

            if (serializedProperty == null)
            {
                return(false);
            }
            EditorGUILayout.PropertyField(serializedProperty, new GUILayoutOption[0]);
            MonoScript monoScript = serializedProperty.objectReferenceValue as MonoScript;
            bool       flag       = true;

            if (monoScript != null && monoScript.GetScriptTypeWasJustCreatedFromComponentMenu())
            {
                flag = false;
            }
            if (flag)
            {
                GUIContent gUIContent = EditorGUIUtility.TextContent("GenericInspector.ScriptIsInvalid");
                EditorGUILayout.HelpBox(gUIContent.text, MessageType.Warning, true);
            }
            if (base.serializedObject.ApplyModifiedProperties())
            {
                EditorUtility.ForceRebuildInspectors();
            }
            return(true);
        }
コード例 #4
0
        public bool MissingMonoBehaviourGUI()
        {
            base.serializedObject.Update();
            SerializedProperty serializedProperty = base.serializedObject.FindProperty("m_Script");
            bool result;

            if (serializedProperty == null)
            {
                result = false;
            }
            else
            {
                EditorGUILayout.PropertyField(serializedProperty, new GUILayoutOption[0]);
                MonoScript monoScript = serializedProperty.objectReferenceValue as MonoScript;
                bool       flag       = true;
                if (monoScript != null && monoScript.GetScriptTypeWasJustCreatedFromComponentMenu())
                {
                    flag = false;
                }
                if (flag)
                {
                    GUIContent gUIContent = EditorGUIUtility.TrTextContent("The associated script can not be loaded.\nPlease fix any compile errors\nand assign a valid script.", null, null);
                    EditorGUILayout.HelpBox(gUIContent.text, MessageType.Warning, true);
                }
                if (base.serializedObject.ApplyModifiedProperties())
                {
                    EditorUtility.ForceRebuildInspectors();
                }
                result = true;
            }
            return(result);
        }
コード例 #5
0
        internal static void CheckIfScriptLoaded(SerializedProperty scriptProperty)
        {
            MonoScript targetScript      = scriptProperty.objectReferenceValue as MonoScript;
            bool       showScriptWarning = targetScript == null || !targetScript.GetScriptTypeWasJustCreatedFromComponentMenu();

            if (showScriptWarning)
            {
                var text = L10n.Tr("The associated script can not be loaded.\nPlease fix any compile errors\nand assign a valid script.");
                EditorGUILayout.HelpBox(text, MessageType.Warning, true);
            }
        }
コード例 #6
0
        private static bool CheckIfScriptLoaded(SerializedProperty scriptProperty)
        {
            MonoScript targetScript = scriptProperty?.objectReferenceValue as MonoScript;

            return(targetScript != null && targetScript.GetScriptTypeWasJustCreatedFromComponentMenu());
        }