- Home /
Load the Same Level, but Different Configurations?
Hi there everyone! I've made a horror app and I have had request to have different modes. The level is set within a forest, at night. People are asking for a daylight mode, and I am trying to implement a stormy version as well.
I've cloned the scene and add the changed preferences and added it into the selection of different level version. It works... but it dramatically increases the size of my app since I have the WHOLE SCENE duplicated again, for each version!
Is there a simple way (if possible in script form) of having the level preferences change, say when I'm at the main menu and there are 3 different versions of the level (night, day, storm) and all of them are the same level, but somehow they change? I've seen this before in other horror apps and the size of the app is definitely not as big as my app has become.
Take a look at this :)
Okay I have finally gone down a list of many things I've added to my game. Now I'm reading through this and trying to understand it.
I'm copying the scripts and I get this error:
Assets/Level Selection/DialogueElement.cs(21,16): error CS0246: The type or namespace name `List' could not be found. Are you missing a using directive or an assembly reference?
I'm not sure what's going on. I'm following the tutorial and I got this error message...
You might need to add
using System.Collections.Generic;
to the top of that class to use List. Otherwise, show the relevant bits of code
I've came across that on the forums and done so, but the error still doesn't go away. Here's the script I've gotten together from the tutorial:
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
[System.Serializable]
public class DialogueElement
{
public enum Characters{ $$anonymous$$, $$anonymous$$egan};
public enum AvatarPos{ left, right};
public Characters Character;
public AvatarPos CharacterPosition;
public Texture2D CharacterPic;
public string DialogueText;
public GUIStyle DialogueTextStyle;
public float TextPlayBackSpeed;
public AudioClip PlayBackSoundFile;
}
public class Dialogue: ScriptableObject
{
public List DialogItems;
}
Answer by getyour411 · Feb 16, 2014 at 08:47 PM
Sample list declaration (adopt to your stuff)
public List<QM_Skills> playerSkills = new List<QM_Skills> ();
http://unity3d.com/learn/tutorials/modules/intermediate/scripting/lists-and-dictionaries
I've applied what you have given me and the error goes away:
public class Dialogue: ScriptableObject
{
public List<DialogueElement> DialogItems = new List<DialogueElement> ();
}
But now I get this error from the other script in the tutorial:
Assets/Dialogue/Editor/DialogueAsset.cs(10,17): error CS0103: The name `ScriptableObjectUtility' does not exist in the current context
The "DialogueAsset.cs" is meant to be within an Editor Folder.
using UnityEngine;
using UnityEditor;
using System;
public class DialogueAsest
{
[$$anonymous$$enuItem("Assets/Create/Dialogue")]
public static void CreateAsset ()
{
ScriptableObjectUtility.CreateAsset ();
}
}
Only place I find ScriptableObjectUtility is Unity wiki - do you have it?
http://wiki.unity3d.com/index.php?title=CreateScriptableObjectAsset
Answer by Halo500 · Feb 17, 2014 at 09:02 PM
Okay, a new question has came up. I have done everything and fixed the scripts up a little bit to my liking for the Level Selection Configurations and I've made it VERY basic at the moment.
How do I apply it though? I've placed it on a Main Camera and press play, but the skybox does not change and the fog does not activate. (I'm much newer to C# than Javascript)
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
[System.Serializable]
public class LevelElement
{
public enum Levels{ Night, Day, Storm };
//public enum AvatarPos{ left, right};
public Levels Level;
//public AvatarPos CharacterPosition;
//public Texture2D LevelPic;
//public string DialogueText;
//public GUIStyle DialogueTextStyle;
//public float TextPlayBackSpeed;
//public AudioClip PlayBackSoundFile;
public Material dayMaterial;
public Material nightMaterial;
void LevelSelection(){
RenderSettings.skybox = nightMaterial;
//RenderSettings.skybox = dayMaterial;
RenderSettings.fog = true;
//RenderSettings.fog = false;
}
}
public class Level: ScriptableObject
{
public List<LevelElement> LevelItems = new List<LevelElement> ();
}
Your answer
Follow this Question
Related Questions
Should player & pickups be children of the level, or keep them separate? 2 Answers
Load a random scene from a list of strings. 2 Answers
help please: Level Changing Scipt 1 Answer
Level freezes on loading dynamically 0 Answers
linking levels? 2 Answers