- Home /
Question by
bitthebillias · Feb 03, 2019 at 02:44 AM ·
savinglevel loadmanagementlevel select
manage objects through a manager script
so, i am trying to manage different level triggers through a level managing script. what i am trying to figure out is how to turn on and off different cubes through the exiting of the level and loading the Hub world, enabling the next one.
this is what I have so far:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class LevelChecks : MonoBehaviour
{
public bool objectToDisable1 = false;
public static LevelChecks control;
public bool DesertLevel;
void Awake()
{
if (control == null)
{
DontDestroyOnLoad(gameObject);
control = this;
}
else if (control != this)
{
Destroy(gameObject);
}
}
public void DesertLevelCheck()
{
if(objectToDisable1 == true)
{
GameObject.Find("Desert").SetActive (true);
} else
{
GameObject.Find("Desert").SetActive(false);
}
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityStandardAssets.Characters.FirstPerson;
public class LevelChange : MonoBehaviour
{
public string sceneName;
public LevelChecks LevelManager;
void OnTriggerEnter(Collider c)
{
if (c.tag == "Player")
UnityEngine.SceneManagement.SceneManager.LoadScene("Hub");
}
public void CharacterCameraRefresh()
{
GameObject.Find("FPSController").GetComponent<FirstPersonController>().enabled = false;
GameObject.Find("FPSController").GetComponent<FirstPersonController>().enabled = true;
}
}
Comment
Your answer
Follow this Question
Related Questions
Level Selector not working on build 0 Answers
How to load scenes based on specific percentage? 0 Answers
How to make an exit level trigger? 3 Answers
Load scene transistions 1 Answer
How can I lock a Level? 2 Answers