Class CommonContextAPI | Data Flow Graph | 0.19.0-preview.7
docs.unity3d.com
    Show / Hide Table of Contents

    Class CommonContextAPI

    Inheritance
    Object
    CommonContextAPI
    Inherited Members
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Object.ReferenceEquals(Object, Object)
    Object.ToString()
    Namespace: Unity.DataFlowGraph
    Syntax
    public static class CommonContextAPI

    Methods

    EmitMessage<TContext, T, TNodeDefinition>(ref TContext, MessageOutput<TNodeDefinition, T>, T)

    Emit a message from yourself on a port. Everything connected to it will receive your message.

    Declaration
    public static void EmitMessage<TContext, T, TNodeDefinition>(this ref TContext self, MessageOutput<TNodeDefinition, T> port, in T msg)
        where TContext : struct, IContext<TContext> where TNodeDefinition : NodeDefinition
    Parameters
    Type Name Description
    TContext self
    MessageOutput<TNodeDefinition, T> port
    T msg
    Type Parameters
    Name Description
    TContext
    T
    TNodeDefinition

    EmitMessage<TContext, T, TNodeDefinition>(ref TContext, PortArray<MessageOutput<TNodeDefinition, T>>, Int32, T)

    Emit a message from yourself on a port array. Everything connected to it will receive your message.

    Declaration
    public static void EmitMessage<TContext, T, TNodeDefinition>(this ref TContext self, PortArray<MessageOutput<TNodeDefinition, T>> port, int arrayIndex, in T msg)
        where TContext : struct, IContext<TContext> where TNodeDefinition : NodeDefinition
    Parameters
    Type Name Description
    TContext self
    PortArray<MessageOutput<TNodeDefinition, T>> port
    Int32 arrayIndex
    T msg
    Type Parameters
    Name Description
    TContext
    T
    TNodeDefinition
    Exceptions
    Type Condition
    IndexOutOfRangeException

    Thrown if the index is out of range with respect to the port array.

    RegisterForUpdate<TContext>(ref TContext)

    Registers the current node for regular updates every time Update() is called. This only takes effect after the next Update(). RemoveFromUpdate<TContext>(ref TContext)

    Declaration
    public static void RegisterForUpdate<TContext>(this ref TContext self)
        where TContext : struct, IContext<TContext>
    Parameters
    Type Name Description
    TContext self
    Type Parameters
    Name Description
    TContext
    Remarks

    A node will automatically be removed from the update list when it is destroyed.

    Exceptions
    Type Condition
    InvalidNodeDefinitionException

    Will be thrown if the current node does not support updating.

    InvalidOperationException

    Thrown if the current node is already registered for updating.

    RemoveFromUpdate<TContext>(ref TContext)

    Deregisters the current node from updating every time Update() is called. This only takes effect after the next Update(). RegisterForUpdate<TContext>(ref TContext)

    Declaration
    public static void RemoveFromUpdate<TContext>(this ref TContext self)
        where TContext : struct, IContext<TContext>
    Parameters
    Type Name Description
    TContext self
    Type Parameters
    Name Description
    TContext
    Exceptions
    Type Condition
    InvalidOperationException

    Thrown if the current node is not registered for updating.

    SetKernelBufferSize<TContext, TGraphKernel>(ref TContext, TGraphKernel)

    Declaration
    [Obsolete("Renamed to UpdateKernelBuffers (RemovedAfter 2021-01-19)")]
    public static void SetKernelBufferSize<TContext, TGraphKernel>(this ref TContext self, in TGraphKernel requestedSize)
        where TContext : struct, IContext<TContext> where TGraphKernel : struct, IGraphKernel
    Parameters
    Type Name Description
    TContext self
    TGraphKernel requestedSize
    Type Parameters
    Name Description
    TContext
    TGraphKernel

    UpdateKernelBuffers<TContext, TGraphKernel>(ref TContext, TGraphKernel)

    Updates the contents of Buffer<T>s appearing in this node's IGraphKernel<TKernelData, TKernelPortDefinition>. Pass an instance of the node's IGraphKernel<TKernelData, TKernelPortDefinition> as the requestedContents parameter with Buffer<T> instances within it having been set using UploadRequest<TContext, T>(ref TContext, NativeArray<T>, BufferUploadMethod), or SizeRequest(Int32). Any Buffer<T> instances within the given struct that have default values will be unaffected by the call.

    Declaration
    public static void UpdateKernelBuffers<TContext, TGraphKernel>(this ref TContext self, in TGraphKernel requestedSize)
        where TContext : struct, IContext<TContext> where TGraphKernel : struct, IGraphKernel
    Parameters
    Type Name Description
    TContext self
    TGraphKernel requestedSize
    Type Parameters
    Name Description
    TContext
    TGraphKernel

    UpdateKernelData<TContext, TKernelData>(ref TContext, TKernelData)

    Updates the associated TKernelData asynchronously, to be available in a IGraphKernel in the next render.

    Declaration
    public static void UpdateKernelData<TContext, TKernelData>(this ref TContext self, in TKernelData data)
        where TContext : struct, IContext<TContext> where TKernelData : struct, IKernelData
    Parameters
    Type Name Description
    TContext self
    TKernelData data
    Type Parameters
    Name Description
    TContext
    TKernelData

    UploadRequest<TContext, T>(ref TContext, NativeArray<T>, BufferUploadMethod)

    The return value should be used together with UpdateKernelBuffers<TContext, TGraphKernel>(ref TContext, TGraphKernel) to change the contents of a kernel buffer living on a IGraphKernel<TKernelData, TKernelPortDefinition>.

    Declaration
    public static Buffer<T> UploadRequest<TContext, T>(this ref TContext self, NativeArray<T> inputMemory, BufferUploadMethod method = BufferUploadMethod.Copy)
        where TContext : struct, IContext<TContext> where T : struct
    Parameters
    Type Name Description
    TContext self
    NativeArray<T> inputMemory
    BufferUploadMethod method
    Returns
    Type Description
    Buffer<T>
    Type Parameters
    Name Description
    TContext
    T
    Remarks

    This will resize the affected buffer to the same size as inputMemory. Failing to include the return value in a call to UpdateKernelBuffers<TContext, TGraphKernel>(ref TContext, TGraphKernel) is an error and will result in a memory leak.

    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023