// Use this for initialization void Start() { showLevelsButton = transform.Find("Home/ButtonGame").gameObject; editModeButton = transform.Find("Home/ButtonEditor").gameObject; playerNameText = transform.Find("Home/PlayerNameText").gameObject; levelContent = transform.Find("Levels/Scroll View/Viewport/LevelContent"); levelInfoPanel = transform.Find("LevelInfoPanel").gameObject; confirmWindow = transform.Find("ConfirmWindow").gameObject; levelsPanel = transform.Find("Levels").gameObject; confirmWindow.SetActive(false); levelsPanel.SetActive(false); showLevelsButton.GetComponent <Button>().onClick.AddListener(delegate() { levelsPanel.SetActive(true); }); editModeButton.GetComponent <Button>().onClick.AddListener(delegate() { GameManager.editMode = true; SceneManager.LoadScene("Game"); }); dontDestroy = GameObject.Find("DontDestroy").GetComponent <DontDestroy>(); player = dontDestroy.player; playerNameText.GetComponent <Text>().text = player.name; LoadMapInfo(); }
IEnumerator FadeScreen(Image blackFade, bool won) { while (blackFade.color.a < 1) { blackFade.color = new Vector4(0, 0, 0, blackFade.color.a + 0.02f); yield return(new WaitForSeconds(0.05f)); if (blackFade.color.a >= 0.95f) { dontDestroyObject = FindObjectOfType <DontDestroy>(); if (dontDestroyObject != null) { dontDestroyObject.ChangeName(); } if (won) { meny.SwitchScene(mainMenu); } else { ResetPositions(); } } } }
void Start() { Cursor.visible = true; Cursor.lockState = CursorLockMode.None; CameFromScene = FindObjectOfType <DontDestroy>(); chSelect = GetComponent <ChapterSelect>(); print(CameFromScene.gameObject.name); switch (CameFromScene.gameObject.name) { case "Prolog": chSelect.SwitchToScene(scenes[0].gameObject); print("Prolog"); break; case "Kapitel 1": chSelect.SwitchToScene(scenes[1].gameObject); print("Kaptiel 1"); break; case "Kapitel 2": chSelect.SwitchToScene(scenes[2].gameObject); print("Kapitel 2"); break; default: print("None of the above"); chSelect.SwitchToScene(mainMenu); break; } }
private IEnumerator Start() { StateMachine = GetComponent <StateMachine>(); _buildingEnvironmatentState = gameObject.AddComponent <BuildingEnvironmatentState>(); _setupAnimationsState = gameObject.AddComponent <SetupAnimationsState>(); _editEnvironmentState = gameObject.AddComponent <EditEnvironmentState>(); _viewModeState = gameObject.AddComponent <ViewModeState>(); StateMachine.States.Add(_buildingEnvironmatentState); StateMachine.States.Add(_setupAnimationsState); StateMachine.States.Add(_editEnvironmentState); StateMachine.States.Add(_viewModeState); StateMachine.CurrentState = _viewModeState; StateMachine.CurrentState.ActivateState(); DontDestroy = FindObjectOfType <DontDestroy>(); while (EnvironmentResourcesManager.isReady == false) { yield return(null); } DeserializeSceneContent(); }
void Start() { DontDestroy.Clean(); SGK.LuaController.DisposeInstance(); Invoke("Reload", 0.2f); }
/// <summary> /// // DontDestroyOnLoad用 /// </summary> private void OnDestroy() { if (this == Instance) { dontDestroy = null; } }
// Use this for initialization void Start() { dontDestroy = GameObject.FindGameObjectWithTag("dontdestroy"); score = GameObject.FindGameObjectWithTag("finalScore").GetComponent <GUIText>(); information = dontDestroy.GetComponent <DontDestroy>(); score.text = "Score: " + information.totalScore; //print ("total score " + information.totalScore); }
private void OnDestroy() { // 破棄時に、登録した実体の解除を行う if (this == Instance) { Instance = null; } }
private void Awake() { if (instance == null) { instance = this; DontDestroyOnLoad(instance); } }
void Start() { DontDestroy IP = (DontDestroy)GameObject.Find("SERVER IP").GetComponent("DontDestroy"); getURL = "http://" + IP.QuestionJSON + getURL; Keeper = (DontDestroy)GameObject.Find("SessionHash").GetComponent("DontDestroy"); }
public void btn_main_menu_Click() { Time.timeScale = 1.0f; DontDestroy.DestroyAll(); SceneManager.LoadScene("title", LoadSceneMode.Single); }
private void Start() { DontDestroy parentFunction = GetComponentInParent <DontDestroy>(); controllerName = parentFunction.controllerName; agent = GetComponent <UnityEngine.AI.NavMeshAgent>(); fixSpeed = speed; }
// Update is called once per frame void Update() { if (Input.GetAxis("Submit") == 1) { DontDestroy.removeObject(); SceneManager.LoadScene(scene); } }
// Use this for initialization void Start () { if(instance == null) { instance = this; DontDestroyOnLoad(gameObject); } else { Destroy(gameObject); } }
private void Reset() { if (File.Exists(Application.persistentDataPath + "/game.fun")) { File.Delete(Application.persistentDataPath + "/game.fun"); } DontDestroy.DestroyAll(); SceneManager.LoadScene(0); }
// Use this for initialization void Start() { keepGO = GameObject.FindGameObjectWithTag("dontdestroy"); keep = keepGO.GetComponent <DontDestroy> (); //pizzas = 6; pizzas = keep.pizzas; duration = Time.time + 50f; // print ("frames per second " + 1.0f / Time.deltaTime); }
private static void RestartManagers() { RoomManager.Restart(); SchoolManager.Restart(); GarageManager.Restart(); TManager.Restart(); DontDestroy.Restart(); Clearing(); }
// Main Start Function void Start() { LoginText = UsernameField.GetComponentsInChildren <Text>()[0] as Text; PasswordText = PasswordField.GetComponentsInChildren <InputField>()[0] as InputField; DontDestroy IP = (DontDestroy)GameObject.Find("SERVER IP").GetComponent("DontDestroy"); getURL = "http://" + IP.QuestionJSON + getURL; }
void Awake() { if (instance != null && instance != this) { Destroy(this.gameObject); return; } else { instance = this; } DontDestroyOnLoad(this.gameObject); }
// Start is called before the first frame update void Start() { if (Instance != null) { Destroy(this.gameObject); } Instance = this; DontDestroyOnLoad(this.gameObject); }
//***************************************************// // public void goToBattle(string webResult) { DontDestroy Keeper = (DontDestroy)GameObject.Find("QuestionPacker").GetComponent("DontDestroy"); Keeper.QuestionJSON = webResult; SceneLoader Loader = (SceneLoader)GameObject.Find("SceneManager").GetComponent("SceneLoader"); Loader.LoadScene("BattleScene"); }
public void setIP() { DontDestroy ServerIPHolder = (DontDestroy)GameObject.Find("SERVER IP").GetComponent("DontDestroy"); Text fieldText = (Text)field.GetComponentsInChildren <Text>()[0] as Text; ServerIPHolder.QuestionJSON = fieldText.text; lobbymenu.SetActive(true); ipconfigmenu.SetActive(false); }
public void OnValidate() { if (this.editorValidated == false) { #pragma warning disable 612,618 this.dontDestroy = this.dontDestroyOnLoad == true ? DontDestroy.OnSceneChange : DontDestroy.Auto; this.editorValidated = true; #pragma warning restore 612,618 } }
private void Start() { rWS = FindObjectOfType <RouletteWheelSpin>(); wP = FindObjectOfType <WinningsPayout>(); nRS = FindObjectOfType <NumberReaderScript>(); sBI = FindObjectOfType <SaveBetInfo>(); dD = FindObjectOfType <DontDestroy>(); winner = false; soundCount = 3; }
private void Awake() { if (Instance == null) { Instance = this; DontDestroyOnLoad(Instance); return; } Destroy(this.gameObject); }
public void MenuScene() { dD = FindObjectOfType <DontDestroy>(); if (dD != null) { dD.Destroy(); } SceneManager.LoadScene("Gamescene_Menu"); }
void Awake() { if (shared) { DestroyImmediate(gameObject); return; } shared = this; DontDestroyOnLoad(gameObject); }
void Awake() { //Destorys any copt object that was created when the scene loaded DontDestroyOnLoad(this); if (FindObjectsOfType(GetType()).Length > 1) { Destroy(gameObject); } instance = this; }
//**************************************************************// // Main Start Function void Start() { DontDestroy IP = (DontDestroy)GameObject.Find("SERVER IP").GetComponent("DontDestroy"); getURL = "http://" + IP.QuestionJSON + getURL; // Initializae Variables GOButtonList = new List <GameObject>(); Keeper = (DontDestroy)GameObject.Find("SessionHash").GetComponent("DontDestroy"); StartCoroutine(LoadBattleList()); }
private void Awake() { if (current != null) { Destroy(gameObject); return; } DontDestroyOnLoad(gameObject); current = this; }
public static void removeObject() { if (instance != null) { foreach (AudioSource audio in instance.GetComponents <AudioSource>()) { audio.Stop(); } instance = null; } }
private void Awake() { if (instance != null) { DestroyImmediate(this); } else { instance = this; } }
void Start() { if (instance != null && instance != this) { Destroy(this.gameObject); return; } DontDestroyOnLoad(this.gameObject); instance = this; }
void Start() { if (duplicate) //Destroy the game object this script is attached to if it already exists DestroyImmediate(gameObject); else { //Causes UI object not to be destroyed when loading a new scene. DontDestroyOnLoad(gameObject); duplicate = this; } }
// Use this for initialization void Awake() { DontDestroyOnLoad (this); if (instance == null) { instance = this; Debug.Log ("Test: " + instance); } else if (this == instance) { Debug.Log ("Hit"); DontDestroyOnLoad (transform.gameObject); } else { Debug.Log ("Hit1"); thatTransform = transform; Destroy(this.gameObject); } }
void Awake() { // If there is no instance of this class... if (instance == null) { // ...then set the instance to this. instance = this; } // Otherwise, if an instance does not equal this... else if (instance != this) { // ...then destroy this game object to enforce the singleton pattern. Destroy (gameObject); } // When a new scene loads, don't destroy this game object. DontDestroyOnLoad(this.gameObject); }
void Awake() { //Get a reference to ShowPanels attached to UI object showPanels = GetComponent<ShowPanels> (); //Get a reference to PlayMusic attached to UI object playMusic = GetComponent<PlayMusic> (); dontDestroy = GetComponent<DontDestroy> (); //Check if there is an existing instance of this object if((instance) && (instance.GetInstanceID() != GetInstanceID())) DestroyImmediate(gameObject); //Delete duplicate else { instance = this; //Make this object the only instance DontDestroyOnLoad (gameObject); //Set as do not destroy } }