Giter Club home page Giter Club logo

node-inspector's Introduction

#NodeInspector If you like to use scriptable object as config files you probably know how hard is maintain references from one object to another. This project would help you to organize your objects.

this is what you will get at the end of this simple tutorial

Simple nodes

#Graph Graph is a set of nodes connected by references. In our case we have ScriptableObject as a graph nodes. To start work what we need is to define Graph scriptable object which will keep links to all nodes. and all nodes just need to be inherited from ScriptableObjectNode class. If you open this class you will find that it just have one more property WindowRect. this property used in inspector to store information about node position.

It's possible that you want to store information about start node you can use it as well using directives. so let's start implement this

#MyConfig.cs I'll create test class which will keep some properties and have a link to another object.

using UnityEngine;
using NodeInspector;

[NodeMenuItem("MyConfigNode")] //This directive create option menu in the inspector
[OneWay]       // If you won't provide this attribute you won't be abble to link to this instance as inputnode
public class MyConfigNode : ScriptableObjectNode {
    [OneWay]  //next property will have output link to another node
    public MyConfigNode LinkToNode;
    public int          TestInt;
    public LayerMask    TestLayerMask;
    [OneWay]
    public MyConfigNode LinkToAdditionalNode;
}

As you see it's really simple class you just keep some properties here.

#MyConfigNodeHolder

using UnityEngine;
using System.Collections.Generic;
using NodeInspector;

[CreateAssetMenu] //This is standard unity feature. Create instance of this object in assets
public class MyConfigHolder : ScriptableObject { 
    [Graph("StartNode")] //this is a name of the property of this class
    public List<MyConfigNode> Nodes;

    public MyConfigNode StartNode; //if you don't need a start node you don't need to use Graph parameter
}

you can use several graphs at one scriptable object. but you graph must be a List of ScriptableObjectNode type or classes deprived from it.

So this is it. now you can create instance of your ConfigHodler object and start work with you graph. Right click at your project window and select Create/My Config Holder after that you will have just asset in the folder. to start working with it you need to open node inspector it located at the top unity bar Window/Node Inspector

At the top left corner of the inspector you will find menu which create instances of your node. This is it. now you can freely connect your nodes as you wish. and if you want to create some node as start node just use context menu or toplight menu of the nodes.

node-inspector's People

Contributors

hatigamedev avatar nicloay avatar senritsu avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.