mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-03-24 11:24:52 -05:00
38 lines
1.0 KiB
C#
38 lines
1.0 KiB
C#
using UnityEngine;
|
|
#if UNITY_2020_2_OR_NEWER
|
|
using UnityEditor.AssetImporters;
|
|
#else
|
|
using UnityEditor.Experimental.AssetImporters;
|
|
#endif
|
|
|
|
|
|
namespace UniVRM10
|
|
{
|
|
[ScriptedImporter(1, "vrm")]
|
|
public class VrmScriptedImporter : ScriptedImporter
|
|
{
|
|
[SerializeField]
|
|
public bool MigrateToVrm1 = default;
|
|
|
|
[SerializeField]
|
|
public UniGLTF.RenderPipelineTypes RenderPipeline = default;
|
|
|
|
public override void OnImportAsset(AssetImportContext ctx)
|
|
{
|
|
VrmScriptedImporterImpl.Import(this, ctx, MigrateToVrm1, RenderPipeline);
|
|
}
|
|
|
|
void OnValidate()
|
|
{
|
|
if (RenderPipeline == UniGLTF.RenderPipelineTypes.UniversalRenderPipeline)
|
|
{
|
|
if (Shader.Find(UniGLTF.GltfPbrUrpMaterialImporter.ShaderName) == null)
|
|
{
|
|
Debug.LogWarning("URP is not installed. Force to BuiltinRenderPipeline");
|
|
RenderPipeline = UniGLTF.RenderPipelineTypes.BuiltinRenderPipeline;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|