Beispiel #1
0
 private ScriptAssemblySettings CreateScriptAssemblySettings(BuildTargetGroup buildTargetGroup, BuildTarget buildTarget, EditorScriptCompilationOptions definesOptions)
 {
     string[] compilationDefines = InternalEditorUtility.GetCompilationDefines(definesOptions, buildTargetGroup, buildTarget);
     return(new ScriptAssemblySettings
     {
         BuildTarget = buildTarget,
         BuildTargetGroup = buildTargetGroup,
         OutputDirectory = EditorCompilation.EditorAssemblyPath,
         Defines = compilationDefines,
         ApiCompatibilityLevel = PlayerSettings.GetApiCompatibilityLevel(buildTargetGroup),
         FilenameSuffix = this.assemblySuffix
     });
 }
Beispiel #2
0
        private void DrawDefineConstraintListElement(Rect rect, int index, bool isactive, bool isfocused)
        {
            var list             = m_DefineConstraints.list;
            var defineConstraint = list[index] as DefineConstraint;

            rect.height -= EditorGUIUtility.standardVerticalSpacing;


            var textFieldRect = new Rect(rect.x, rect.y + Styles.kCenterHeightOffset, rect.width - ReorderableList.Defaults.dragHandleWidth, rect.height);

            string noValue = L10n.Tr("(Missing)");

            var  label = string.IsNullOrEmpty(defineConstraint.name) ? noValue : defineConstraint.name;
            bool mixed = defineConstraint.displayValue == Compatibility.Mixed;

            EditorGUI.showMixedValue = mixed;
            var textFieldValue = EditorGUI.TextField(textFieldRect, mixed ? L10n.Tr("(Multiple Values)") : label);

            EditorGUI.showMixedValue = false;

            var defines = InternalEditorUtility.GetCompilationDefines(EditorScriptCompilationOptions.BuildingForEditor, EditorUserBuildSettings.activeBuildTargetGroup, EditorUserBuildSettings.activeBuildTarget);

            if (defines != null)
            {
                var status = DefineConstraintsHelper.GetDefineConstraintCompatibility(defines, defineConstraint.name);
                var image  = status == DefineConstraintsHelper.DefineConstraintStatus.Compatible ? Styles.validDefineConstraint : Styles.invalidDefineConstraint;

                var content = new GUIContent(image, Styles.GetIndividualTooltipFromDefineConstraintStatus(status));

                var constraintValidityRect = new Rect(rect.width + ReorderableList.Defaults.dragHandleWidth + Styles.kValidityIconWidth / 4, rect.y + Styles.kCenterHeightOffset, Styles.kValidityIconWidth, Styles.kValidityIconHeight);
                EditorGUI.LabelField(constraintValidityRect, content);
            }

            if (!string.IsNullOrEmpty(textFieldValue) && textFieldValue != noValue && defineConstraint.name != textFieldValue)
            {
                m_HasModified         = true;
                defineConstraint.name = textFieldValue;
            }
        }
Beispiel #3
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();
            using (new EditorGUI.DisabledScope(false))
            {
                var isManagedPlugin = importers.All(x => x.dllType == DllType.ManagedNET35 || x.dllType == DllType.ManagedNET40);
                if (isManagedPlugin)
                {
                    ShowReferenceOptions();
                    GUILayout.Space(10f);
                }

                GUILayout.Label(Styles.kPluginPlatforms, EditorStyles.boldLabel);
                EditorGUILayout.BeginVertical(GUI.skin.box);
                ShowGeneralOptions();
                EditorGUILayout.EndVertical();
                GUILayout.Space(10f);

                if (IsEditingPlatformSettingsSupported())
                {
                    ShowPlatformSettings();
                }

                if (isManagedPlugin)
                {
                    GUILayout.Label(Styles.kDefineConstraints, EditorStyles.boldLabel);

                    if (m_DefineConstraints.list.Count > 0)
                    {
                        var defines = InternalEditorUtility.GetCompilationDefines(EditorScriptCompilationOptions.BuildingForEditor, EditorUserBuildSettings.activeBuildTargetGroup, EditorUserBuildSettings.activeBuildTarget);

                        var defineConstraintsCompatible = true;

                        if (defines != null)
                        {
                            for (var i = 0; i < m_DefineConstraints.list.Count && defineConstraintsCompatible; ++i)
                            {
                                var defineConstraint = ((DefineConstraint)m_DefineConstraints.list[i]).name;

                                if (DefineConstraintsHelper.GetDefineConstraintCompatibility(defines, defineConstraint) != DefineConstraintsHelper.DefineConstraintStatus.Compatible)
                                {
                                    defineConstraintsCompatible = false;
                                }
                            }

                            var constraintValidityRect = new Rect(GUILayoutUtility.GetLastRect());
                            constraintValidityRect.x = constraintValidityRect.width - Styles.kValidityIconWidth / 4;
                            var image   = defineConstraintsCompatible ? Styles.validDefineConstraint : Styles.invalidDefineConstraint;
                            var tooltip = Styles.GetTitleTooltipFromDefineConstraintCompatibility(defineConstraintsCompatible);
                            var content = new GUIContent(image, tooltip);

                            constraintValidityRect.width  = Styles.kValidityIconWidth;
                            constraintValidityRect.height = Styles.kValidityIconHeight;
                            EditorGUI.LabelField(constraintValidityRect, content);
                        }
                    }

                    m_DefineConstraints.DoLayoutList();
                }

                if (importers.All(imp => imp.isNativePlugin))
                {
                    GUILayout.Space(10f);
                    GUILayout.Label(Styles.kLoadSettings, EditorStyles.boldLabel);
                    ShowLoadSettings();
                }
            }

            serializedObject.ApplyModifiedProperties();

            ApplyRevertGUI();

            // Don't output additional information if we have multiple plugins selected
            if (targets.Length > 1)
            {
                return;
            }

            GUILayout.Label(Styles.kInformation, EditorStyles.boldLabel);

            m_InformationScrollPosition = EditorGUILayout.BeginVerticalScrollView(m_InformationScrollPosition);

            foreach (var prop in m_PluginInformation)
            {
                GUILayout.BeginHorizontal();
                GUILayout.Label(prop.Key, GUILayout.Width(85));
                EditorGUILayout.SelectableLabel(prop.Value, GUILayout.Height(EditorGUI.kSingleLineHeight));
                GUILayout.EndHorizontal();
            }

            EditorGUILayout.EndScrollView();
            GUILayout.FlexibleSpace();

            // Warning for Case 648027
            // Once Mono loads a native plugin, it never releases a handle, thus plugin is never unloaded.
            if (importer.isNativePlugin)
            {
                EditorGUILayout.HelpBox("Once a native plugin is loaded from script, it's never unloaded. If you deselect a native plugin and it's already loaded, please restart Unity.", MessageType.Warning);
            }
        }