Search Unity

How to get editor window to apply the correct data field when given type?

Discussion in 'Scripting' started by Rick-Gamez, Dec 1, 2015.

  1. Rick-Gamez

    Rick-Gamez

    Joined:
    Mar 23, 2015
    Posts:
    218
    Hey all I'm working on a window that is basically a game save interface. What it does is finds scriptable objects and gets all the variables out of it, then allows you to choose which of those variables will be recorded by the game save class.

    note: the data is recorded into a class called "Table" (Tables are a custom class that I built that is similar to dictionary but is serializable here's an example)
    Code (csharp):
    1.  
    2. public Table<ScriptableObject, Table<string,object>> varDefaults = new Table<ScriptableObject, Table<string, object>> ();
    3.  
    ***
    here is how the data is put into the table
    theTable <TheScriptableObjectReference, Table<VarName, VarValue>>
    ***

    I would like for the window to give fields to set defaults to these variables (so that the game saver can restore defaults when told).

    I have the data recording correctly into the Table above but how would I tell the editor window to place the correct field type for default data input when I call the variable out of the <string, object> side of the Table?

    Sorry if this confuses you and thanks in advance.