GameObjectType

This commit is contained in:
ousttrue
2022-05-17 13:41:50 +09:00
parent 41a7aeda65
commit b6b1294479
3 changed files with 61 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
using UnityEditor;
using UnityEngine;
namespace UniGLTF.MeshUtility
{
public enum GameObjectType
{
Null,
SceneInstance,
PrefabInstance,
AssetPrefab,
}
public static class GameObjectTypeUtility
{
public static GameObjectType GetGameObjectType(this GameObject go)
{
if (go == null)
{
return GameObjectType.Null;
}
if (!go.scene.IsValid())
{
if (PrefabUtility.IsPartOfAnyPrefab(go))
{
return GameObjectType.AssetPrefab;
}
else
{
throw new System.Exception("unknown");
}
}
if (PrefabUtility.IsPartOfAnyPrefab(go))
{
return GameObjectType.PrefabInstance;
}
return GameObjectType.SceneInstance;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 95cda911ba335b449901767f9bee8ca8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -104,6 +104,13 @@ namespace VRM
OnValidate();
}
protected override bool DrawWizardGUI()
{
var t = m_root.GetGameObjectType();
EditorGUILayout.HelpBox($"{t}", MessageType.Info);
return base.DrawWizardGUI();
}
static object GetPropertyValue(Shader shader, int i, Material m)
{
var propType = ShaderUtil.GetPropertyType(shader, i);