LoadSceneAdditive

From Unify Community Wiki
(Difference between revisions)
Jump to: navigation, search
m (Text replace - "<javascript>" to "<syntaxhighlight lang="javascript">")
m (Text replace - "</javascript>" to "</syntaxhighlight>")
 
Line 21: Line 21:
 
return;  
 
return;  
 
}
 
}
</javascript>
+
</syntaxhighlight>

Latest revision as of 20:52, 10 January 2012

Found this in forums, added a little extra. Copies one scene into another. Originally by cyb3rmaniak and kino, thanks guys.

@MenuItem("File/Load Scene [Additive]") 
static function Apply () 
{ 
	var strScenePath : String = AssetDatabase.GetAssetPath(Selection.activeObject); 
	if (strScenePath == null) 
	{
		EditorUtility.DisplayDialog("Select Scene", "You Must Select a Scene first!", "Ok"); 
		return; 
	} 
	if (!strScenePath.Contains(".unity"))
	{
		EditorUtility.DisplayDialog("Select Scene","You Must Select a SCENE first, you selected "+strScenePath, "Ok"); 
		return; 
	}
 
	Debug.Log("Opening " + strScenePath + " additively"); 
	EditorApplication.OpenSceneAdditive(strScenePath); 
	return; 
}
Personal tools
Namespaces

Variants
Actions
Navigation
Extras
Toolbox