Exemplo n.º 1
0
    static void SaveObject(GameObject go, GameObjectClass parent)
    {
        Component[] comps = go.GetComponents <Component>();
        foreach (var comp in comps)
        {
            ComponentClass childComp = ComponentFactory.CreateComponentClass(comp);
            parent.components.Add(childComp);
        }
        for (var i = 0; i < go.transform.childCount; i++)
        {
            GameObject      child   = go.transform.GetChild(i).transform.gameObject;
            GameObjectClass childGO = new GameObjectClass(child);
            parent.children.Add(childGO);

            SaveObject(child, childGO);
        }
    }