SetDefaultReferences() private méthode

private SetDefaultReferences ( string name, Object target ) : void
name string
target Object
Résultat void
        private static void ResetDefaultReferences(MenuCommand command)
        {
            MonoImporter monoImporter = command.context as MonoImporter;

            monoImporter.SetDefaultReferences(new string[0], new UnityEngine.Object[0]);
            AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(monoImporter));
        }
        public override void OnInspectorGUI()
        {
            MonoImporter monoImporter = this.target as MonoImporter;
            MonoScript   script       = monoImporter.GetScript();

            if (script)
            {
                Type @class = script.GetClass();
                if (!MonoScriptImporterInspector.IsTypeCompatible(@class))
                {
                    EditorGUILayout.HelpBox("No MonoBehaviour scripts in the file, or their names do not match the file name.", MessageType.Info);
                }
                Vector2 iconSize = EditorGUIUtility.GetIconSize();
                EditorGUIUtility.SetIconSize(new Vector2(16f, 16f));
                List <string>             list  = new List <string>();
                List <UnityEngine.Object> list2 = new List <UnityEngine.Object>();
                bool flag = false;
                this.ShowFieldInfo(@class, monoImporter, list, list2, ref flag);
                EditorGUIUtility.SetIconSize(iconSize);
                if (flag)
                {
                    monoImporter.SetDefaultReferences(list.ToArray(), list2.ToArray());
                    AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(monoImporter));
                }
            }
        }
        public override void OnInspectorGUI()
        {
            MonoImporter monoImporter = base.target as MonoImporter;
            MonoScript   script       = monoImporter.GetScript();

            if (script)
            {
                Type @class = script.GetClass();
                if (!InternalEditorUtility.IsInEditorFolder(monoImporter.assetPath))
                {
                    if (!MonoScriptImporterInspector.IsTypeCompatible(@class))
                    {
                        EditorGUILayout.HelpBox("No MonoBehaviour scripts in the file, or their names do not match the file name.", MessageType.Info);
                    }
                }
                List <string>             list  = new List <string>();
                List <UnityEngine.Object> list2 = new List <UnityEngine.Object>();
                bool flag = false;
                using (new EditorGUIUtility.IconSizeScope(new Vector2(16f, 16f)))
                {
                    this.ShowFieldInfo(@class, monoImporter, list, list2, ref flag);
                }
                if (list2.Count != 0)
                {
                    EditorGUILayout.HelpBox("Default references will only be applied in edit mode.", MessageType.Info);
                }
                if (flag)
                {
                    monoImporter.SetDefaultReferences(list.ToArray(), list2.ToArray());
                    AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(monoImporter));
                }
            }
        }
Exemple #4
0
        public override void OnInspectorGUI()
        {
            MonoImporter target = this.target as MonoImporter;
            MonoScript   script = target.GetScript();

            if (script != null)
            {
                System.Type type = script.GetClass();
                if (!IsTypeCompatible(type))
                {
                    EditorGUILayout.HelpBox("No MonoBehaviour scripts in the file, or their names do not match the file name.", MessageType.Info);
                }
                Vector2 iconSize = EditorGUIUtility.GetIconSize();
                EditorGUIUtility.SetIconSize(new Vector2(16f, 16f));
                List <string>             names   = new List <string>();
                List <UnityEngine.Object> objects = new List <UnityEngine.Object>();
                bool didModify = false;
                this.ShowFieldInfo(type, target, names, objects, ref didModify);
                EditorGUIUtility.SetIconSize(iconSize);
                if (didModify)
                {
                    target.SetDefaultReferences(names.ToArray(), objects.ToArray());
                    AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(target));
                }
            }
        }
Exemple #5
0
        private static void ResetDefaultReferences(MenuCommand command)
        {
            MonoImporter context = command.context as MonoImporter;

            context.SetDefaultReferences(new string[0], new Object[0]);
            AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(context));
        }