- Home /
Why won't my terrain load.
I made a script that gets the player's world settings from the world setttings menu, and then load s the settigns in the next scene when the player continues. The terrain won't spawn. Please Help!!
Script in world settings menu: using System.Collections; using System.Collections.Generic; using UnityEngine; public class WorldSettings : MonoBehaviour { public bool FlatTerrain = false; public bool SemiBumpyTerrain = false; %|133382897_3|% // Use this for initialization void Start() %|-1971751899_6|% %|1244436034_8|% // Update is called once per frame %|-657146416_10|% %|-890458070_11|% %|-251084513_12|% %|-562753640_13|% { FlatTerrain = true; Application.LoadLevel("level1"); %|-582002089_17|% public void SemiBumpy() %|-831506893_19|% SemiBumpyTerrain = true; Application.LoadLevel("level1"); } public void VeryBumpy() { %|-526449255_25|% Application.LoadLevel("level1"); %|686669248_27|% }
Script in level after world settings: using System.Collections; using System.Collections.Generic; using UnityEngine; public class LoadWorldManager : MonoBehaviour { %|131026995_28|% public GameObject SemiBumpyTerrain; %|1237642956_30|% %|-902328880_31|% private WorldSettings WorldSettingsScript; %|-273883866_33|% { %|-1035811350_35|% FlatTerrain = Resources.Load("Flat_Terrain") as GameObject; %|-1575055408_37|% %|-562377359_38|% WorldSettingsScript = GameObject.Find("WorldSettings").GetComponent<WorldSettings>(); %|1449107905_40|% // Use this for initialization %|-1750449121_42|% %|1783188651_43|% { Instantiate(FlatTerrain, WorldSpawnPos, transform.rotation); %|1936957349_46|% if (WorldSettingsScript.SemiBumpyTerrain) { %|-70310332_49|% %|-1273183901_50|% if (WorldSettingsScript.VeryBumpyTerrain) %|-1583253834_52|% Instantiate(VeryBumpyTerrain, WorldSpawnPos, transform.rotation); %|882424543_54|% %|376581494_55|% { %|1821030991_57|% } %|-1166234788_59|% { Instantiate(VeryBumpyTerrain, WorldSpawnPos, transform.rotation); } %|-1005049537_63|% %|-1308870501_65|% %|-2139788344_66|% %|1449002551_67|% }
THX!!!
Your answer
Follow this Question
Related Questions
Resources.Load(path+name) as texture == null reference 7 Answers
Saving a randomly generated Terrain 1 Answer
Resource folder resources loading 1 Answer
Mass terrain generation 1 Answer