using System;
using System.Collections.Generic;
using System.Linq;
using UnityEditor.Build.Content;
using UnityEditor.Build.Pipeline.Injector;
using UnityEditor.Build.Pipeline.Interfaces;
using UnityEditor.Build.Utilities;
using UnityEngine;
namespace UnityEditor.Build.Pipeline.Tasks
{
///
/// Optional build task that extracts Unity's built in shaders and assigns them to the specified bundle
///
[Obsolete("CreateBuiltInShaders has been replaced with CreateBuiltInBundle.")]
public class CreateBuiltInShadersBundle : IBuildTask
{
static readonly GUID k_BuiltInGuid = new GUID(CommonStrings.UnityBuiltInExtraGuid);
///
public int Version { get { return 1; } }
#pragma warning disable 649
[InjectContext(ContextUsage.In)]
IDependencyData m_DependencyData;
[InjectContext(ContextUsage.InOut, true)]
IBundleExplictObjectLayout m_Layout;
#pragma warning restore 649
///
/// Stores the name for the built-in shaders bundle.
///
public string ShaderBundleName { get; set; }
///
/// Create the built-in shaders bundle.
///
/// The name of the bundle.
public CreateBuiltInShadersBundle(string bundleName)
{
ShaderBundleName = bundleName;
}
///
public ReturnCode Run()
{
IBuildContext context = new BuildContext(m_DependencyData, m_Layout);
CreateBuiltInBundle createBuiltInBundle = new CreateBuiltInBundle(ShaderBundleName);
ContextInjector.Inject(context, createBuiltInBundle );
ReturnCode result = createBuiltInBundle.Run();
ContextInjector.Extract(context, createBuiltInBundle);
m_DependencyData = context.GetContextObject();
m_Layout = context.GetContextObject();
return result;
}
}
}