• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
Question by frankyboy450 · Apr 03, 2012 at 11:12 PM · editorterrainscenezombie

merge scene in the editor

hi. i have 2 scenes in my project. how do i add everything from scene 1 to scene 2?

Comment

People who like this

0 Show 0
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

3 Replies

· Add your reply
  • Sort: 
avatar image
Best Answer

Answer by frankyboy450 · May 01, 2012 at 10:18 AM

never mind. i figures out how to do it anyway

Comment

People who like this

0 Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image axCed · Jul 31, 2014 at 03:15 PM 0
Share

You can select the content in scene 1 and do a basic copy/paste in scene 2.

avatar image scvn8010 · Oct 17, 2014 at 04:20 AM 0
Share

I do a copy basic copy/paste as you said, I copy some object from scene 1 to scene 2 but some object lost texture. How can I merge 2 scene into 1 scene

avatar image

Answer by baroquedub · Oct 01, 2015 at 12:04 PM

For @frankyboy450 and any others who are still confused about how to implement this... (the Unity Script Reference isn't quite as useful as it might be as it only shows part of the script you'll need, and provides no help on where to put it.)

First create an Editor folder in your Assets, if one doesn't already exist. Inside that create a new C# script:

alt text

Name the file the same as your class name, for example AddScene.cs

Here's the full code you'll need:

 using UnityEngine;
 using UnityEditor;
 using System.IO;
     
 public class AddScene
 {
     // Simple script that lets you load the contents of a selected scene 
     // to your current scene.
 
     [@MenuItem("Example/Load Scene Additive")]
     static void Apply()
     {
         string strScenePath = AssetDatabase.GetAssetPath(Selection.activeObject);
         if (strScenePath == null || !strScenePath.Contains(".unity"))
         {
             EditorUtility.DisplayDialog("Select Scene", "You Must Select a Scene!", "Ok");
             EditorApplication.Beep();
             return;
         }
         Debug.Log("Opening " + strScenePath + " additively");
         EditorApplication.OpenSceneAdditive(strScenePath);
     }
 }

Note the use of EditorApplication.OpenSceneAdditive(strScenePath); as per the answer given above.

What this does is add a new item in your editor: [@MenuItem("Example/Load Scene Additive")]

alt text

The above code is straight from the Unity Script Reference (http://docs.unity3d.com/ScriptReference/EditorApplication.OpenSceneAdditive.html)

I found another slightly more elegant implementation on GitHub (https://gist.github.com/AngryAnt/6192566) which places the item under the File menu. 'Combine Scenes' remains greyed out until you select two scenes in your Project window:

 using UnityEngine;
 using UnityEditor;
 using System.IO;
 
 public class AddScene
 {
     [MenuItem("File/Combine Scenes")]
     static void Combine()
     {
         Object[] objects = Selection.objects;
 
         EditorApplication.SaveCurrentSceneIfUserWantsTo();
         EditorApplication.NewScene();
 
         foreach (Object item in objects)
         {
             EditorApplication.OpenSceneAdditive(AssetDatabase.GetAssetPath(item));
         }
     }
 
 
     [MenuItem("File/Combine Scenes", true)]
     static bool CanCombine()
     {
         if (Selection.objects.Length < 2)
         {
             return false;
         }
 
         foreach (Object item in Selection.objects)
         {
             if (!Path.GetExtension(AssetDatabase.GetAssetPath(item)).ToLower().Equals(".unity"))
             {
                 return false;
             }
         }
 
         return true;
     }
 }


I hope that's useful to someone :)


unity-editor-script.png (40.0 kB)
unity-editor-new-item.png (50.3 kB)
Comment
KwahuNashoba
unity_vxWvnWQhKakyQQ

People who like this

2 Show 0 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image

Answer by syclamoth · Apr 03, 2012 at 11:15 PM

In an editor script, use

 EditorAppliction.OpenSceneAdditive("Path/To/Scene.unity");

Then, just save normally and the two will have become one!

Comment
CavenDigital

People who like this

1 Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image frankyboy450 · Apr 04, 2012 at 05:51 AM 0
Share

and how do i do this? where can i make an editor script?

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Object2Terrain error/wont work. 1 Answer

A node in a childnode? 1 Answer

Edit terrain using js 1 Answer

Disable shadow in the Grass 2D texture Terrain 0 Answers

terrain not showing 5 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges