- Home /
Question by
CrashCZ · Feb 04, 2018 at 09:12 AM ·
scenescene-loadingscene-switchingscenesscene load
Load Scene from .unity File
Hello. I'm making a level editor for my game and I need to know how to Load a level's scene the level from a .unity or YAML file. So players can upload .unity files to a server and then download and run them.
Comment
Answer by KittenSnipes · Feb 04, 2018 at 02:27 PM
I think this should work. I hope it does. Cheers!
using UnityEngine;
using UnityEngine.SceneManagement;
public class PutScriptNameHere : MonoBehaviour {
public AssetBundle bundle;
public int sceneId = 0;
string[] scenePath;
void Start()
{
scenePath = bundle.GetAllScenePaths();
AsyncOperation async = SceneManager.LoadSceneAsync(System.IO.Path.GetFileNameWithoutExtension(scenePath[sceneId]));
}
}
Your answer
Follow this Question
Related Questions
One Location Game (with Scenes Loaded and Disabled) 0 Answers
Change Scene keeping Character and GUI Canvas 1 Answer
Multiple scenes 2 Answers
Unity Scene loading problem (slow loading until it freezes) 0 Answers
Help with error message "Overwriting the same path as another open scene is not allowed" 0 Answers