SHARE
TWEET

Making scenes in Unity3d like a SIR

dimmpixeye Oct 17th, 2017 759 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*===============================================================
  2. Product:    Unity3d Utilities
  3. Developer:  Dimitry Pixeye - pixeye@hbrew.store
  4. Company:    Homebrew - http://hbrew.store
  5. Date:       16/09/2017 01:51
  6. ================================================================*/
  7. // Add script to SceneManager/Editor/
  8.  
  9. using UnityEditor;
  10. using UnityEditor.SceneManagement;
  11. using UnityEngine.SceneManagement;
  12. using UnityEngine;
  13.  
  14.  
  15. [InitializeOnLoad]
  16. public class SceneGenerator  {
  17.  
  18.  
  19.     static SceneGenerator()
  20.     {
  21.         EditorSceneManager.newSceneCreated += SceneCreating;
  22.     }
  23.  
  24.  
  25.     public static void SceneCreating(Scene scene, NewSceneSetup setup, NewSceneMode mode)
  26.     {
  27.        
  28.         var camGO = Camera.main.transform;
  29.         var lightGO = GameObject.Find("Directional Light").transform;
  30.        
  31.         var setupFolder = new GameObject("[SETUP]").transform;
  32.         var lights = new GameObject("Lights").transform;
  33.         lights.parent = setupFolder;
  34.         lightGO.parent = lights;
  35.  
  36.         var cam  = new GameObject("Cameras").transform;
  37.         cam.parent = setupFolder;
  38.         camGO.parent = cam;
  39.  
  40.         var world = new GameObject("[WORLD]").transform;
  41.         new GameObject("Static").transform.parent = world;
  42.         new GameObject("Dynamic").transform.parent = world;
  43.  
  44.         new GameObject("[UI]");
  45.        
  46.         Debug.Log("New scene created!");
  47.  
  48.     }
  49.    
  50.  
  51. }
RAW Paste Data
Top