avatar/Assets/VRCSDK/Dependencies/VRChat/Editor/ShaderStripping/StripAndroidAvatars.cs
2022-09-27 20:47:45 -07:00

41 lines
1.0 KiB
C#

using System.Collections.Generic;
using UnityEditor;
using UnityEditor.Build;
using UnityEditor.Build.Reporting;
using UnityEditor.Rendering;
using UnityEngine;
using VRC.SDKBase.Editor.BuildPipeline;
public class StripAndroidAvatars : IPreprocessShaders, IVRCSDKBuildRequestedCallback, IPostprocessBuildWithReport
{
private static VRCSDKRequestedBuildType? _buildType = null;
public int callbackOrder => 0;
public bool OnBuildRequested(VRCSDKRequestedBuildType requestedBuildType)
{
_buildType = requestedBuildType;
return true;
}
public void OnProcessShader(Shader shader, ShaderSnippetData snippet, IList<ShaderCompilerData> data)
{
if(_buildType != VRCSDKRequestedBuildType.Avatar)
{
return;
}
if(EditorUserBuildSettings.activeBuildTarget != BuildTarget.Android)
{
return;
}
data.Clear();
}
public void OnPostprocessBuild(BuildReport report)
{
_buildType = null;
}
}