docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Implement a block node

    This procedure assumes you have already implemented a context node, as described in Implement a context node.

    To implement a block node:

    1. Define a class that inherits from the BlockNode base class
    2. Add the UseWithContext attribute to connect it to your context node

    The resulting code looks like:

    
    [UseWithContext(typeof(MyContextNode))]
    [Serializable]
    public class MyBlockNode : BlockNode
    {
    }
    
    

    To relate a block node to several context nodes, list them separated with a comma in your UseWithContext attribute:

    
    [UseWithContext(typeof(MyContextNode), typeof(MyOtherContextNode))]
    [Serializable]
    public class MyBlockNodeWithMultipleContexts : BlockNode
    {
    }
    
    

    Block nodes inherit all features available in its parent Node class. Review Implement a node to learn how to customize your node with node options, ports, and orientation settings.

    Next step

    • Instantiate and manage block nodes

    Related scripting API documentation

    • ContextNode
    • BlockNode
    • UseWithContextAttribute
    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)