mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-09-13 06:20:01 -05:00
UnityObjectManager is not unnecessary for prefab
This commit is contained in:
@@ -55,9 +55,11 @@ namespace UniGLTF
|
||||
{
|
||||
context.AddObjectToAsset(k.Name, o);
|
||||
});
|
||||
var root = loaded.Root;
|
||||
GameObject.DestroyImmediate(loaded);
|
||||
|
||||
context.AddObjectToAsset(loaded.name, loaded.gameObject);
|
||||
context.SetMainObject(loaded.gameObject);
|
||||
context.AddObjectToAsset(root.name, root);
|
||||
context.SetMainObject(root);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,18 +139,20 @@ namespace VRM
|
||||
m_paths.Clear();
|
||||
m_paths.Add(m_prefabPath);
|
||||
loaded.TransferOwnership(SaveAsAsset);
|
||||
var root = loaded.Root;
|
||||
GameObject.DestroyImmediate(loaded);
|
||||
|
||||
// Create or update Main Asset
|
||||
if (m_prefabPath.IsFileExists)
|
||||
{
|
||||
Debug.LogFormat("replace prefab: {0}", m_prefabPath);
|
||||
var prefab = m_prefabPath.LoadAsset<GameObject>();
|
||||
PrefabUtility.SaveAsPrefabAssetAndConnect(loaded.gameObject, m_prefabPath.Value, InteractionMode.AutomatedAction);
|
||||
PrefabUtility.SaveAsPrefabAssetAndConnect(root, m_prefabPath.Value, InteractionMode.AutomatedAction);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogFormat("create prefab: {0}", m_prefabPath);
|
||||
PrefabUtility.SaveAsPrefabAssetAndConnect(loaded.gameObject, m_prefabPath.Value, InteractionMode.AutomatedAction);
|
||||
PrefabUtility.SaveAsPrefabAssetAndConnect(root, m_prefabPath.Value, InteractionMode.AutomatedAction);
|
||||
}
|
||||
|
||||
foreach (var x in m_paths)
|
||||
|
||||
@@ -49,9 +49,11 @@ namespace UniVRM10
|
||||
{
|
||||
context.AddObjectToAsset(key.Name, o);
|
||||
});
|
||||
var root = loaded.Root;
|
||||
GameObject.DestroyImmediate(loaded);
|
||||
|
||||
context.AddObjectToAsset(loaded.name, loaded.gameObject);
|
||||
context.SetMainObject(loaded.gameObject);
|
||||
context.AddObjectToAsset(root.name, root);
|
||||
context.SetMainObject(root);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user