Firstborn/Library/PackageCache/com.unity.scriptablebuildpi.../Editor/Tasks/SwitchToBuildPlatform.cs
Schaken-Mods 7502018d20 Adding Mod Support
There is an asset in the store I grabbed. the coding is WAY above my head, I got about half of it and integrated and adapted what I can to it. im going as far as I can with it and ill come back in a few month when I understand t better.
2023-05-13 22:01:48 -05:00

36 lines
1.0 KiB
C#

using UnityEditor.Build.Pipeline.Injector;
using UnityEditor.Build.Pipeline.Interfaces;
using UnityEditor.Build.Pipeline.Utilities;
namespace UnityEditor.Build.Pipeline.Tasks
{
/// <summary>
/// Sets the target build platform based on the build parameters.
/// </summary>
public class SwitchToBuildPlatform : IBuildTask
{
/// <inheritdoc />
public int Version { get { return 1; } }
#pragma warning disable 649
[InjectContext(ContextUsage.In)]
IBuildParameters m_Parameters;
[InjectContext(ContextUsage.In, true)]
IEditorBuildCallbacks m_InterfaceWrapper;
#pragma warning restore 649
/// <inheritdoc />
public ReturnCode Run()
{
if (EditorUserBuildSettings.SwitchActiveBuildTarget(m_Parameters.Group, m_Parameters.Target))
{
if (m_InterfaceWrapper != null)
m_InterfaceWrapper.InitializeCallbacks();
return ReturnCode.Success;
}
return ReturnCode.Error;
}
}
}