-
-
Notifications
You must be signed in to change notification settings - Fork 12
How to Create a new Source
James Veugelaers edited this page May 6, 2025
·
4 revisions
A Source is a way for the Build Uploader to retrieve folders/files so it can then be saved to a temporary location in preparation of being modified and uploaded.
The Build Uploader uses reflection to find all classes inheriting from ABuildSource and displays them in a dropdown to be chosen. BuildSourceAttribute defines static data about the source such as what text to show in the dropdown.
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using UnityEditor;
using UnityEngine;
using Wireframe;
[BuildSource("Resources", "Resources")]
public class ResourcesSource : ABuildSource
{
public override void OnGUIExpanded(ref bool isDirty)
{
// Draw all details about the source to be modified
// Set isDirty to true to indicate a save needs to be made.
}
public override void OnGUICollapsed(ref bool isDirty, float maxWidth)
{
// Draw a simple 1 line GUI of what the source is
// Set isDirty to true to indicate a save needs to be made.
}
public override Task<bool> GetSource(BuildConfig buildConfig, BuildTaskReport.StepResult stepResult)
{
// Write your code here to get the information of the source and set them in a variable
return Task.FromResult(true);
}
public override string SourceFilePath()
{
// Return the path of the folder or file you want to be copied over to the cache
return "path to files";
}
public override float DownloadProgress()
{
return m_downloadProgress;
}
public override string ProgressTitle()
{
return "ScenesFolder";
}
public override string ProgressDescription()
{
return m_progressDescription;
}
public override bool IsSetup(out string reason)
{
// Return false if the source is not correctly setup to avoid starting a build in a bad state
reason = "";
return true;
}
public override string GetBuildDescription()
{
return ""; // Unused
}
public override Dictionary<string, object> Serialize()
{
Dictionary<string, object> data = new Dictionary<string, object>
{
// Nothing
};
return data;
}
public override void Deserialize(Dictionary<string, object> data)
{
// Nothing
}
}