using System;
using System.Collections.Generic;
using System.Linq;
using UnityEditor.Build;
using UnityEngine;
using Object = UnityEngine.Object;
namespace UnityEditor.XR.ARSubsystems
{
///
/// Class with helper methods for interacting with the build process.
///
public static class BuildHelper
{
///
/// Adds a background shader with the given name to the project as a preloaded asset.
///
/// The name of a shader to add to the project.
/// Thrown if a shader with the given name cannot be
/// found.
public static void AddBackgroundShaderToProject(string shaderName)
{
if (string.IsNullOrEmpty(shaderName))
{
Debug.LogWarning("Incompatible render pipeline in GraphicsSettings.currentRenderPipeline. Background "
+ "rendering may not operate properly.");
}
else
{
Shader shader = FindShaderOrFailBuild(shaderName);
Object[] preloadedAssets = PlayerSettings.GetPreloadedAssets();
var shaderAssets = (from preloadedAsset in preloadedAssets where shader.Equals(preloadedAsset)
select preloadedAsset);
if ((shaderAssets == null) || !shaderAssets.Any())
{
List