mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-05-09 04:01:35 -05:00
Merge pull request #796 from ousttrue/fix/prefab_unity2020
Fix/prefab unity2020
This commit is contained in:
commit
0b3c3488ed
|
|
@ -3,8 +3,13 @@ using System.Collections.Generic;
|
|||
using System.IO;
|
||||
using System.Linq;
|
||||
using UnityEditor;
|
||||
using UnityEditor.Experimental.AssetImporters;
|
||||
using UnityEngine;
|
||||
#if UNITY_2020_2_OR_NEWER
|
||||
using UnityEditor.AssetImporters;
|
||||
#else
|
||||
using UnityEditor.Experimental.AssetImporters;
|
||||
#endif
|
||||
|
||||
|
||||
namespace UniGLTF
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,10 @@
|
|||
using UnityEditor.Experimental.AssetImporters;
|
||||
|
||||
using UnityEngine;
|
||||
#if UNITY_2020_2_OR_NEWER
|
||||
using UnityEditor.AssetImporters;
|
||||
#else
|
||||
using UnityEditor.Experimental.AssetImporters;
|
||||
#endif
|
||||
|
||||
|
||||
namespace UniGLTF
|
||||
|
|
|
|||
|
|
@ -1,6 +1,11 @@
|
|||
using UnityEditor;
|
||||
using UnityEditor.Experimental.AssetImporters;
|
||||
using UnityEngine;
|
||||
#if UNITY_2020_2_OR_NEWER
|
||||
using UnityEditor.AssetImporters;
|
||||
#else
|
||||
using UnityEditor.Experimental.AssetImporters;
|
||||
#endif
|
||||
|
||||
|
||||
namespace UniGLTF
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,10 @@
|
|||
using UnityEditor.Experimental.AssetImporters;
|
||||
|
||||
using UnityEngine;
|
||||
#if UNITY_2020_2_OR_NEWER
|
||||
using UnityEditor.AssetImporters;
|
||||
#else
|
||||
using UnityEditor.Experimental.AssetImporters;
|
||||
#endif
|
||||
|
||||
|
||||
namespace UniGLTF
|
||||
|
|
|
|||
|
|
@ -1,6 +1,11 @@
|
|||
using UnityEditor;
|
||||
using UnityEditor.Experimental.AssetImporters;
|
||||
using UnityEngine;
|
||||
#if UNITY_2020_2_OR_NEWER
|
||||
using UnityEditor.AssetImporters;
|
||||
#else
|
||||
using UnityEditor.Experimental.AssetImporters;
|
||||
#endif
|
||||
|
||||
|
||||
namespace UniGLTF
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,8 +1,12 @@
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using UnityEditor.Experimental.AssetImporters;
|
||||
using UnityEditor;
|
||||
#if UNITY_2020_2_OR_NEWER
|
||||
using UnityEditor.AssetImporters;
|
||||
#else
|
||||
using UnityEditor.Experimental.AssetImporters;
|
||||
#endif
|
||||
|
||||
|
||||
namespace UniGLTF
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,8 +1,13 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEditor;
|
||||
using UnityEditor.Experimental.AssetImporters;
|
||||
using UnityEngine;
|
||||
#if UNITY_2020_2_OR_NEWER
|
||||
using UnityEditor.AssetImporters;
|
||||
#else
|
||||
using UnityEditor.Experimental.AssetImporters;
|
||||
#endif
|
||||
|
||||
|
||||
namespace UniGLTF
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MeshUtility
|
||||
|
|
@ -22,24 +23,39 @@ namespace MeshUtility
|
|||
}
|
||||
|
||||
#region ExportRoot管理
|
||||
GameObject m_root;
|
||||
(GameObject GameObject, bool IsPrefab) m_root;
|
||||
public event Action<GameObject> ExportRootChanged;
|
||||
void RaiseExportRootChanged()
|
||||
{
|
||||
var tmp = ExportRootChanged;
|
||||
if (tmp == null) return;
|
||||
tmp(m_root);
|
||||
tmp(m_root.GameObject);
|
||||
}
|
||||
public GameObject ExportRoot
|
||||
{
|
||||
get { return m_root; }
|
||||
get { return m_root.GameObject; }
|
||||
set
|
||||
{
|
||||
if (m_root == value)
|
||||
string assetPath = default;
|
||||
var isPrefab = false;
|
||||
if (value != null && AssetDatabase.IsMainAsset(value))
|
||||
{
|
||||
assetPath = AssetDatabase.GetAssetPath(value);
|
||||
isPrefab = true;
|
||||
value = PrefabUtility.LoadPrefabContents(assetPath);
|
||||
}
|
||||
if (m_root.GameObject == value)
|
||||
{
|
||||
return;
|
||||
}
|
||||
m_root = value;
|
||||
if (m_root.IsPrefab)
|
||||
{
|
||||
#if VRM_DEVELOP
|
||||
Debug.Log($"PrefabUtility.UnloadPrefabContents({m_root.GameObject})");
|
||||
#endif
|
||||
PrefabUtility.UnloadPrefabContents(m_root.GameObject);
|
||||
}
|
||||
m_root = (value, isPrefab);
|
||||
m_requireValidation = true;
|
||||
RaiseExportRootChanged();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,15 @@
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using UnityEditor.Experimental.AssetImporters;
|
||||
using UnityEditor;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
#if UNITY_2020_2_OR_NEWER
|
||||
using UnityEditor.AssetImporters;
|
||||
#else
|
||||
using UnityEditor.Experimental.AssetImporters;
|
||||
#endif
|
||||
|
||||
|
||||
namespace UniVRM10
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,14 +1,13 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization.Json;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Assertions;
|
||||
using UnityEditor.Experimental.AssetImporters;
|
||||
using UnityEditor;
|
||||
using VrmLib;
|
||||
#if UNITY_2020_2_OR_NEWER
|
||||
using UnityEditor.AssetImporters;
|
||||
#else
|
||||
using UnityEditor.Experimental.AssetImporters;
|
||||
#endif
|
||||
|
||||
|
||||
namespace UniVRM10
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,9 +1,12 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq;
|
||||
using UnityEditor;
|
||||
using UnityEditor.Experimental.AssetImporters;
|
||||
using UnityEngine;
|
||||
#if UNITY_2020_2_OR_NEWER
|
||||
using UnityEditor.AssetImporters;
|
||||
#else
|
||||
using UnityEditor.Experimental.AssetImporters;
|
||||
#endif
|
||||
|
||||
|
||||
namespace UniVRM10
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user