- Home /
Question by
maxjt · Oct 05, 2012 at 02:57 PM ·
gameobjectscene
Save game objects to new scene
I have this script:
using UnityEditor;
using UnityEngine;
public class ObjectSelector : EditorWindow
{
...
[MenuItem("Edit/Object Selector...")]
public static void ShowWindow()
{
EditorWindow.GetWindow(typeof(ObjectSelector));
}
void OnGUI()
{
...
if(GUILayout.Button("Save objects in new scene")) {
foreach (GameObject gameObject in GameObject.FindObjectsOfType(typeof(GameObject))){
if (...){
// I want to save all this gameObjects in a new scene
// Pseudo-code:
// NewScene.Add(gameObject);
}
}
}
}
}
How can i do that?
PS I use Unity 3.5.5f3 (free-edition)
Comment
LoadLevelAdditive() loads already created level. I need to create a level.