void Load(BuildTarget target,
NodeData node,
IEnumerable <ConnectionData> connectionsToOutput,
PerformGraph.Output Output)
{
if (connectionsToOutput == null || Output == null)
{
return;
}
// SOMEWHERE_FULLPATH/PROJECT_FOLDER/Assets/
var assetsFolderPath = Application.dataPath + AssetBundleGraphSettings.UNITY_FOLDER_SEPARATOR;
var outputSource = new List <AssetReference>();
var targetFilePaths = FileUtility.GetAllFilePathsInFolder(node.GetLoaderFullLoadPath(target));
foreach (var targetFilePath in targetFilePaths)
{
if (targetFilePath.Contains(AssetBundleGraphSettings.ASSETBUNDLEGRAPH_PATH))
{
continue;
}
// already contained into Assets/ folder.
// imported path is Assets/SOMEWHERE_FILE_EXISTS.
if (targetFilePath.StartsWith(assetsFolderPath))
{
var relativePath = targetFilePath.Replace(assetsFolderPath, AssetBundleGraphSettings.ASSETS_PATH);
var r = AssetReferenceDatabase.GetReference(relativePath);
if (!TypeUtility.IsLoadingAsset(r))
{
continue;
}
if (r != null)
{
outputSource.Add(AssetReferenceDatabase.GetReference(relativePath));
}
continue;
}
throw new NodeException(node.Name + ": Invalid Load Path. Path must start with Assets/", node.Name);
}
var output = new Dictionary <string, List <AssetReference> > {
{ "0", outputSource }
};
var dst = (connectionsToOutput == null || !connectionsToOutput.Any())?
null : connectionsToOutput.First();
Output(dst, output);
}