/// <summary>
        /// Executes <see cref="GraphAsset"/>
        /// </summary>
        /// <typeparam name="TArgs">Additional arguments type</typeparam>
        /// <param name="asset">Graph asset to execute</param>
        /// <param name="args">Additional arguments for the executor</param>
        /// <returns>Execution result</returns>
        public static Task <IGraphExecutionResult> ExecuteGraphAsync <TArgs>(GraphAsset asset, TArgs args)
        {
            if (asset == null)
            {
                throw new ArgumentNullException(nameof(asset));
            }

            var graph = asset.Graph;

            return(ExecuteGraphAsync(graph, args));
        }
示例#2
0
        public override void OnImportAsset(AssetImportContext ctx)
        {
            var textGraph = File.ReadAllText(ctx.assetPath, Encoding.UTF8);

            var graph = GraphSerializer.Deserialize(textGraph);

            var graphAsset = GraphAsset.Create(graph);

            ctx.AddObjectToAsset("MainAsset", graphAsset);
            ctx.SetMainObject(graphAsset);
        }