Variable sharing/pointing being lost on play/edit/script change with Editor window

I don’t have any programming background so the terms I use probably mean something totally different. I’m also quite poor at describing my problem.
So when I say a variable links to another, I want it to act as a pointer.
VarA links to VarB. VarA now uses the same memory as VarB.

I’ve made my first editor windows - 3 editors that will set up the variables used ingame for a procedural room generator.
RoomTypes, ModelLists, and Model are all their own classes.
All 3 of these variables are their own array in a script. The editors I’ve made can resize (add, remove) to the arrays.

Room Editor - Creates RoomTypes. The main thing is it has several ModelList variables that link to ModelLists set up in the list editor.
List Editor - Creates ModelLists. Each list has an array of Models that link to the ones made in model editor.
Model Editor - Creates models with various information.


So far, I have this half working. Variables link to each other correctly at first. This is it set up correctly.
http://img36.imageshack.us/img36/363/87908214.jpg
An example of what happens when I change some names - because they link to each other correctly, the names change for everything.
http://img832.imageshack.us/img832/5430/83654058.jpg
However, in this picture I have made a change (Started/ended game, edited script, or restarted editor) than all variables that previously linked correctly before no longer link - they are their own variable with their own data.
http://imageshack.us/m/845/3231/20083208.jpg

My problem is that I want the variables to stay linked to each other even after a play/script change.

Can you post the code you are using? If you assign one array variable to another then both variables end up pointing to the same array but without seeing the code, it won’t be clear if you’ve done this correctly.

It’s messy. But I’ll try…

I’ll paste code only associated with Model Model List.
STANDARD ASSETS
ProcedualClasses - contains all the classes for generating the space.

class Level{
    ..vars..

    var GameRoomTypeList : RoomType[] = new RoomType[1] ;
    var Models : Model[] = new Model[1];
    var ModelList : ModelList[] = new ModelList[1];
    ..vars..
    ..functions..
}//end of Level class function
class Model { //block that is used to store building parts.  Walls, floors, ect. 
    //Contains basic details about archetexturaal models.  
    var name : String;
    var model : GameObject[] = new GameObject[1]; //allows use of prefabs.    //For walls, 0 = plain, 1 = inside, 2 = outside, 3 = door
    var min_Height : float = 0;//how far below 0.0 this goes
    var max_Height : float = 1;//How tall this is

    function DuplicateModel() :Model{ //This function is used so variables won't share same memory when needed.
        var m : Model;
        m.name = name;
        m.model = model;
        m.min_Height = min_Height;
        m.max_Height = max_Height;
        return m;
    }
    ..functions..
}//End of Model class
[CODE]
class ModelList{
    var name : String;
    var description : String;
    var models : Model[];
    function DuplicateList() : ModelList{ //Used to add a new variable to the array, but not use same memory.
        var newList : ModelList;
        newList.models = new Model[models.length]; //models.length
        newList.name = name;
        newList.description = description;
        newList.models = models;
        for (i = 0 ; i > newList.models.length ; ++i){
            //newList.models[i] = models[i];
        }
        return newList;
    }
}//End of ModelList class

[/CODE]SCRIPTS A simple setup script exists. Very little of mainLevel is modified ingame.
GeneratingDummy.js

var mainLevel : Level;
var passcount :int = 5;
//var v : Vector4;
function Start () {
    LevelCreation(); //Uses functions in Level to make rooms.  
    //LevelCreation or ANY function from Level do not touch the variables that have problems linking.  
   
}

EDITOR //The messiest of the messy, I apologize.
MODEL EDITOR

LIST EDITOR

AddModelList RemoveModelList change the size of the array.

          function AddModelList(mainType : ModelList[]) :ModelList[]{ //Adds a new room type to the array.
        var newType = new ModelList[mainType.length + 1];
        for (i = 0 ; i < mainType.length ; ++i){
            //Set mainType  to newType
            newType[i] = mainType[i];
        }
        newType[newType.length - 1] = main.DuplicateList();
        return newType;
    }//addmodel
    
    function RemoveModelList(mainType : ModelList[], numb : int) :ModelList[]{ //Removes the selected room type from the array
        //Until number is hit this is normal.
        //When number is hit, we treat the next number (so i stays same)
        if (mainType.length == 1){
            Debug.Log("CANT REMOVE 0");
            return mainType;
        }
        var newType = new ModelList[mainType.length - 1];
        for (i = 0 ; i < numb ; ++i){
            //Remove numb from array, bring down.
            newType[i] = mainType[i];
        }
        for (i = i ; i < newType.length ; ++i){
            //Remove numb from array, bring down.
            newType[i] = mainType[i + 1];
        }
//        newType[newType.length ] = mainType[mainType.length -1].DuplicateType();
        return newType;
    }//removemodels

AddModel RemoveModel changes the size of the array for invidual ModelList variables.

    function AddModel(mainType : Model[]) :Model[]{ //Adds a new room type to the array.
        var levelVar = GameObject.Find("p_MAIN").GetComponent("GeneratingDummy");
        var newType = new Model[mainType.length + 1];
        for (i = 0 ; i < mainType.length ; ++i){
            //Set mainType  to newType
            newType[i] = mainType[i];
        }
        //newType[newType.length - 1] = main.DuplicateModel();
        newType[newType.length - 1] = levelVar.mainLevel.Models[indexPopup];
        return newType;
    }//addmodel
    function RemoveModel(mainType : Model[], numb : int) :Model[]{ //Removes the selected room type from the array
        //Until number is hit this is normal.
        //When number is hit, we treat the next number (so i stays same)
        if (mainType.length == 1){
            Debug.Log("CANT REMOVE 0");
            return mainType;
        }
        var newType = new Model[mainType.length - 1];
        for (i = 0 ; i < numb ; ++i){
            //Remove numb from array, bring down.
            newType[i] = mainType[i];
        }
        for (i = i ; i < newType.length ; ++i){
            //Remove numb from array, bring down.
            newType[i] = mainType[i + 1];
        }
//        newType[newType.length ] = mainType[mainType.length -1].DuplicateType();
        return newType;
    }//removemodels

So to answer your question, I’m not doing anything special.
I’m literally doing varA = varB.
newType[newType.length - 1] = levelVar.mainLevel.Models[indexPopup]; //I want newType to point to levelVar, and to always copy it.

Edit: Feel free to move this to scripting, just realized it was in GUI.