- Home /
Project architecture having many levels with different scenes and custom properties
Hello!
I'm struggling with building an architecture for project having it's own adventure mode with levels using different scenes but some of them are sharing same scene with parameters which are customing it.
I encountered difficulties when it came to create a complex loading manager, where I want to load custom level with data assigned to depending on my preferences.
I considered creating something like:
public class LevelLoading : MonoBehaviour
{
public static void LoadLevel(int nr)
{
switch (nr)
{
case 1:
FrozenLand.LoadDragonChapter();
CustomSceneManager.LoadSceneWithParams("FrozenLand", nr);
break;
case 2:
DesertLand.LoadDragonChapter();
CustomSceneManager.LoadSceneWithParams("DesertLand", nr);
break;
}
}
}
Problem of this solution is that I need to use static methods to handle data. It's inconvenient.
Another one was to use Singletons in every scene that is doing same as static method, but in this case I need to load scene firstly. It constricts scene that I need to Instantiate most of objects from script just after singleton function.
I also tried to implement scriptable objects, but I found not enough common properties to use it for whole levels.
The most important aspect is I don't exactly know what how the project will be developed, but I want to make architecture which is extensible without using spaghetti code.
I'm interested in opinion of some more experienced people.