Ejemplo n.º 1
0
        private static void ImportSettingsFromProjectContextMenuItem(MenuCommand command)
        {
            ContentInfo contentInfo;

            contentInfo = UpdateContentInfo(command.context.GetType());

            string projectPath;

            projectPath = EditorUtility.OpenFolderPanel("Import Settings From Project", null, null);

            if (!string.IsNullOrEmpty(projectPath))
            {
                DynamicsManagerEditor.ImportDynamicsManagerFromProject(contentInfo.DynamicsManager, projectPath);
                GraphicsSettingsEditor.ImportGraphicsSettingsFromProject(contentInfo.GraphicsSettings, projectPath);
                Physics2DSettingsEditor.ImportPhysics2DSettingsFromProject(contentInfo.Physics2DSettings, projectPath);
                TagManagerEditor.ImportTagManagerFromProject(contentInfo.TagManager, projectPath);
                TimeManagerEditor.ImportTimeManagerFromProject(contentInfo.TimeManager, projectPath);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Updates the <see cref="ContentInfo" /> asset for the specified content submodule.
        /// </summary>
        /// <param name="type">
        /// The <see cref="ContentInfo" /> subclass for the content submodule.
        /// </param>
        public static ContentInfo UpdateContentInfo(System.Type type)
        {
            ContentInfo contentInfo;

            contentInfo = FindOrCreateContentInfo(type);

            SerializedObject serializedObject;

            serializedObject = new SerializedObject(contentInfo);

            serializedObject.FindProperty("m_ResourceAssetBundleName").stringValue = (
                string.IsNullOrEmpty(contentInfo.ResourceAssetBundleName) ?
                GetResourceAssetBundleName(type) :
                contentInfo.ResourceAssetBundleName
                );

            serializedObject.FindProperty("m_SceneAssetBundleName").stringValue = (
                string.IsNullOrEmpty(contentInfo.SceneAssetBundleName) ?
                GetSceneAssetBundleName(type) :
                contentInfo.SceneAssetBundleName
                );

            serializedObject.FindProperty("m_DynamicsManager").objectReferenceValue   = DynamicsManagerEditor.UpdateDynamicsManager(type);
            serializedObject.FindProperty("m_GraphicsSettings").objectReferenceValue  = GraphicsSettingsEditor.UpdateGraphicsSettings(type);
            serializedObject.FindProperty("m_Physics2DSettings").objectReferenceValue = Physics2DSettingsEditor.UpdatePhysics2DSettings(type);
            serializedObject.FindProperty("m_TagManager").objectReferenceValue        = TagManagerEditor.UpdateTagManager(type);
            serializedObject.FindProperty("m_TimeManager").objectReferenceValue       = TimeManagerEditor.UpdateTimeManager(type);

            serializedObject.ApplyModifiedPropertiesWithoutUndo();

            return(FindContentInfo(type));
        }