コード例 #1
0
    public override void Prepare(BuildTarget target, Model.NodeData node,
                                 IEnumerable <PerformGraph.AssetGroups> incoming, IEnumerable <Model.ConnectionData> connectionsToOutput,
                                 PerformGraph.Output Output)
    {
        if (Output != null)
        {
            var destination = connectionsToOutput == null || !connectionsToOutput.Any() ? null : connectionsToOutput.First();

            if (incoming != null)
            {
                var key        = "0";
                var outputDict = new Dictionary <string, List <AssetReference> >();
                outputDict[key] = new List <AssetReference>();
                foreach (var ag in incoming)
                {
                    foreach (var agAssetGroup in ag.assetGroups)
                    {
                        foreach (var assetReference in agAssetGroup.Value)
                        {
                            if (assetReference.extension != ".manifest" && !_ignoreList.Contains(assetReference.fileNameAndExtension))
                            {
                                var bundle = AssetReferenceDatabase.GetAssetBundleReference(assetReference.path);
                                Debug.Log(bundle.fileName);
                                outputDict[key].Add(bundle);
                            }
                        }
                    }
                }

                var customPath     = GetCustomManifestPath(target, node);
                var customManifest = AssetReferenceDatabase.GetAssetBundleManifestReference(customPath);
                outputDict[key].Add(customManifest);

                Output(destination, outputDict);
            }
            else
            {
                Output(destination, new Dictionary <string, List <AssetReference> >());
            }
        }
        else
        {
            Debug.LogError("Output node not set!!! You need attach some node to NodeBundlesManifestCreator!!!");
        }
    }