Databrain Documentation
databrain.ccDiscord
  • Welcome
  • Installation / Update
  • Interface
  • DataObject Property Drawer
    • No GUI Implemented - FIX
  • Getting started
  • Guides
    • Add data objects
    • Add data objects at runtime
    • Get initial data
    • Get/Set runtime data
    • Serialize DataObjects
    • Runtime Save & Load
    • Use custom serializer
    • Import
    • Search
    • Custom GUI
    • Custom GUI with Odin Inspector
    • Hierarchy Template
  • Separate DataObjects
  • Using Version Control
  • Attributes
    • DataObject attributes
    • Field attributes
  • API
    • DataLibrary
    • DataObject
  • FAQ
    • Databrain - FAQ
  • Add-ons
    • Events
    • Blackboard
    • Logic
      • Interface
      • Create Graph
      • Execute graph
      • Control flow execution in groups
      • Custom Nodes
        • Asynchronous execution
        • Node Attributes
      • Scene Components
      • Graph Events
      • Finite State Machine
        • Create custom Actions
        • Examples
        • State Machine Nodes
    • Stats
      • Achievements
      • Modifiers
      • Values
      • Progressions
      • Components
      • Nodes
    • Progress
      • Progress Settings
      • Progress Graph
      • Progress Resources
      • Runtime UI Setup
      • API
        • ProgressController
    • Techtree (LEGACY)
      • Techtree Manager
      • Techtree
      • TechtreeResource
      • Techtree UIBuilder
        • Custom Techtree Node Button
        • Tooltip
      • API
    • Localization
      • Localization Manager
      • Localization
      • Examples
      • Components
      • Import
      • API
    • Inventory
      • Getting started
      • Demo
      • Data setup
        • Inventories
        • Slot IDs
        • Items
          • Blueprints
          • Item rarities
        • Money
        • Loot tables
        • Events
      • Runtime UI
        • Setup
    • Dialogue
      • Getting Started
        • Demo
      • Dialogue runtime setup
      • Actors
        • Emotions
      • Localization
      • Audio
      • Animation
      • Variables
      • Custom theme
      • Import
      • Nodes
      • API
        • DialogueController
        • IDialogueUIControl
  • Changelog
    • Databrain - Changelog
      • 1.4.0
      • 1.3.2
      • 1.3.1
      • 1.3.0
      • 1.2.0
      • 1.1.0
      • 1.0.10
      • 1.0.9
      • 1.0.8
      • 1.0.7
      • <= 1.0.6
Powered by GitBook
On this page
  • Setup
  • UI Setup
  • Demo
  1. Add-ons
  2. Techtree (LEGACY)

Techtree UIBuilder

PreviousTechtreeResourceNextCustom Techtree Node Button

Last updated 1 year ago

The techtree UIBuilder is a runtime component which can build a runtime techtree from an assigned techtree data object.

Setup

  1. Create an empty GameObject in your scene and assign the TechtreeUIBuilder component to it.

  2. Assign all required Techtree references (DataLibrary, Techtree Manager and Techtree).

  3. Next you'll have to define the line connection properties (Orientation, color and width).

UI Setup

Next you will have to prepare the UI and assign the required UI References to the component.

  • Canvas: The actual UI canvas in your scene

  • Node Canvas: This is simply an image element (inside of the canvas) which all nodes will be parented to. The size of this canvas must be set in your techtree:

  • Line Sprite: This is a simple rectangle sprite which is used to create the connection lines. You can use the available sprite from the techtree demo scene.

  • Node Offset: Add an additional offset from the parent node canvas. This could be required, depending on how your techree node buttons look as they might have different sizes than the editor tech nodes.

Once everything is setup you can let the UIBuilder build the techtree directly on Start if the option CreateOnStart is true, or you can manually trigger a build by using the API:

public class TechtreeExample : MonoBehaviour
{
    // Reference to the UIBuilder
    public TechtreeUIBuilder techtree;
    
    // Call to build the techtree
    public void BuildTechtree()
    {
        // Option 1
        techtree.Build();
        
        // Option 2. 
        // You can also pass a techtree data object name which should be 
        // built instead of the assigned techtree in the Techtree UIBuilder component.
        // techtree.Build("PlayerTechtree");
    }
}

Demo

Please make sure to have a look at the demo scene. The demo scene shows you how to dynamically switch a techtree, how to save and load a techtree, start a research, resource management and also how to switch a techtree theme dynamically at runtime.

Techtree Node Button: A techtree button is a prefab which represents each techtree node. There are two available prefabs which you can use directly by default but it's also possible to create your own. Please view the documentation for more information.

Custom Techtree Node Button
set the canvas size in the global properties section of your techtree