Example #1
0
        public GameObject ConstructObject()
        {
            GameObject reference = SafeObjectAccessors.CreateOrFindGameObject(Name);

            foreach (MonoBehaviour c in Components)
            {
                reference.AddComponent(c.GetType());
            }
            foreach (SceneStructureObjectSpecificaton child in Children)
            {
                child.ConstructObject().transform.SetParent(reference.transform);
            }
            return(reference);
        }
    public static void SetupScene(Scene scene, bool fullSetup = false)
    {
        SafeObjectAccessors.CreateOrFindGameObject("[Editor] SceneSetupUtil").CreateOrFindComponent <EditorSceneSetupUtil>();

        if (fullSetup)
        {
            string[] structurePaths = AssetDatabase.FindAssets("name: SceneStructure");
            foreach (string path in structurePaths)
            {
                SceneStructureSpecificationData data = AssetDatabase.LoadAssetAtPath <SceneStructureSpecificationData> (path);
                foreach (SceneStructureSpecificationData.SceneStructureObjectSpecificaton objectSpec in data.StructureObjects)
                {
                    objectSpec.ConstructObject();
                }
            }
        }
    }