Search Unity

Custom Node Editor - Getting the data into a game

Discussion in 'Scripting' started by digitalsalmonfx, Aug 21, 2014.

  1. digitalsalmonfx

    digitalsalmonfx

    Joined:
    Oct 9, 2013
    Posts:
    7
    Hi there,

    I've written up a quick node editor which runs in an editor window. I have a type 'Node' which contains both data about its node graph position, and data which is important to gameplay.

    Consider the node graph a narrative based system - A piece of text is proposed, options are given, and based on player choices the next node is moved to.

    ALL I need is to get a List<Node> out of the editor script, and into some kinda data object (Scriptable Object?).

    'Node' contains a variable (<Node> Target). If Node can be serialised, then the Target is considered data - not a reference. This leads to serialisation depth issues.

    Am I going about this all wrong??
     
  2. akitsu

    akitsu

    Joined:
    Nov 26, 2013
    Posts:
    38
    You could use scriptable object, prefab, xml as you see you have many choices. I self would use xml or scriptable object, because they are easy to serialize / deserialize
     
  3. digitalsalmonfx

    digitalsalmonfx

    Joined:
    Oct 9, 2013
    Posts:
    7
    Cheers for the reply :)

    In classic fashion, I found a solution for the problem within 10 minutes of asking! After reading http://forum.unity3d.com/threads/4-5-serialization-depth.248321/ I decided the best option was to use a unique integer index per node, and reference its index rather than the data itself.

    Problem solved :)

    Cheers anyway!