GetScriptTypeWasJustCreatedFromComponentMenu() private méthode

private GetScriptTypeWasJustCreatedFromComponentMenu ( ) : bool
Résultat bool
        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);
        }
        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);
        }
        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);
        }
Exemple #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);
        }
        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);
            }
        }
Exemple #6
0
        private static bool CheckIfScriptLoaded(SerializedProperty scriptProperty)
        {
            MonoScript targetScript = scriptProperty?.objectReferenceValue as MonoScript;

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