Updating the API in Unity destroyed my scripts, how do I reverse it?
Before the updates my scripts worked perfectly fine, no issues and they executed without a problem. I wanted to learn how to code my pause menu in my UIManager script so that when the pause menu was active, the music would stop playing, so I saw someone's post about the issue and read another person's answer that worked and added it to my script, which caused this to appear:
So naturally I backed up my entire folder onto a separate hard drive(as I regularly do) and then gave the okay to go ahead with the update.
After that, I assigned the script again to the NPC but found I got errors, so I opened the script and put the original script in before the edit. Now during test play, I go to pause the game and notices the screen freezes but my pause menu is nowhere to be seen. I close then reopen it without saving and tried again, only for the same issue to occur.
So I got to the canvas for the pause menu and start deactivating each object and playing to find out what's wrong as I know the script works. After deactivating the buttons and pressing play, my canvas appears once again however my pause menu needs those buttons as they're pretty vital. The buttons are resume, restart, help, main menu and quit, so I can't just overlook this serious issue.
This all happened after I updated the API. After spending several days looking around and coming up with nothing, I really, really need help from the community now more then ever.
How do I reverse the API update? Do I download a previous version of Unity or is there something else that I need to do to get this vital script and pause menu working? The UIManager script is in all scenes in my game and in them the script works fine, it loads and plays without a problem, the transitions between scenes are just fine, the main issue is just that the main menu won't appear when I press the Esc button now unless I uncheck the buttons in the inspector to deactivate them but again those buttons are vital and I need them working.
If it helps, here's a copy of my UIManager:
using UnityEngine; using System.Collections;
public class UIManager : MonoBehaviour { private GameObject[] PauseMenu;
// Use this for initialization
void Start()
{
Time.timeScale = 1;
PauseMenu = GameObject.FindGameObjectsWithTag("ShowOnPause");
hidePaused();
}
// Update is called once per frame
void Update()
{
//uses the Esc button to pause and unpause the game
if (Input.GetKeyDown(KeyCode.Escape))
{
if (Time.timeScale == 1)
{
Time.timeScale = 0;
showPaused();
}
else if (Time.timeScale == 0)
{
Debug.Log("high");
Time.timeScale = 1;
hidePaused();
}
}
}
//Reloads the Level
public void Reload()
{
Application.LoadLevel(Application.loadedLevel);
}
//controls the pausing of the scene
public void pauseControl()
{
if (Time.timeScale == 1)
{
Time.timeScale = 0;
showPaused();
}
else if (Time.timeScale == 0)
{
Time.timeScale = 1;
hidePaused();
}
}
//shows objects with ShowOnPause tag
public void showPaused()
{
foreach (GameObject g in PauseMenu)
{
g.SetActive(true);
}
}
//hides objects with ShowOnPause tag
public void hidePaused()
{
foreach (GameObject g in PauseMenu)
{
g.SetActive(false);
}
}
//loads inputted level
public void LoadLevel(string level)
{
Application.LoadLevel(level);
}
//exits game
public void doExitGame()
{
Application.Quit();
}
}
I would appreciate any advice or help on this matter :)
Answer by CraftyMaelyss · Jan 27, 2017 at 02:42 AM
Well I wasn't able to reverse the changes BUT this alternative might help some developers: (All of my games I keep backed up on a separate hard drive.)
Take screenshots or write down notes for what you've implied and how to do it.
Create a folder on your desktop and call it GameName temp(game name being what your game is called and actually do it on the desktop so you find it easy)
Copy your current game's folder's contents into the temp one.
Open Unity to double check the location of your game.
Delete the contents in the bad game folder that isn't work BUT DO NOT DELETE THE FOLDER ITSELF!
Open the folder of your backup then copy and paste all contents into the now empty folder.
DO NOT DELETE THE TEMP FOLDER, you will need this in case this doesn't work.
Open Unity and make sure "pause on errors" isn't marked otherwise the game won't play.
Go get yourself a sweet treat, you just fixed your game :).
Hopefully this helps some people out who got stuck just like I did and if you need screenshots, feel free to ask and I will upload links, since I think you can only upload 1-2 screenshots in an answer P:
Your answer
Follow this Question
Related Questions
[SOLVED] Unit IAP google play response to update result 1 Answer
LensFlare Doesn't Contain "brightness" Definition?!?! 0 Answers
How do I add music code to my C# without getting a API update prompt? 1 Answer
Steam Leaderboards in Unity, upload time since level load 0 Answers
C# Unity5.3 SceneManager -- Unloading and Loading a specific instance of a Scene. 2 Answers