Quantcast
Channel: Questions in topic: "error message"
Viewing all articles
Browse latest Browse all 2891

Why unity gives me an error but the compiler doesn't?

$
0
0
Unity is giving me an error that is saying : Assets\scripts\Game.cs(70,9): error CS0103: The name 'ZipFile' does not exist in the current context. But the compiler doesn't say that I have an error, I know that to be able to use ZipFile I need to be using System.IO.Compression, and I am using it but and last night it worked, I saved everything, but this morning it gaved me this error, please help me! The problem is in UnZip function... using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Networking; using System.Net; using System; using System.IO; using System.IO.Compression; using System.Diagnostics; [CreateAssetMenu(fileName = "New Game", menuName = "Game")] public class Game : ScriptableObject { public string name; public string exeName; public string url; public Sprite[] Artworks; public Sprite Icon; public int index; private string zipLoc; private string fileLoc; private string exeLoc; string dirLoc; WebClient webClient; public bool Installed() { return File.Exists(exeLoc); } public bool workInProgress; public void init() { if (!Directory.Exists("Games\\")) { Directory.CreateDirectory("Games\\"); } //versiune = PlayerPrefs.GetString(name); webClient = new WebClient(); string n = name.Replace(" ", "_"); fileLoc = "Games\\"; zipLoc = fileLoc +n+ ".zip"; exeLoc = fileLoc + n + "\\" + exeName + ".exe"; dirLoc = fileLoc + n; } public void Install() { webClient.DownloadFile(url, zipLoc); UnZip(); Clear(); } public void Play() { Process.Start(exeLoc); } public void Uninstall() { if (Directory.Exists(dirLoc)) { Directory.Delete(dirLoc, true); } } public void update() { Uninstall(); Install(); } public void UnZip() { ZipFile.ExtractToDirectory(zipLoc, fileLoc); } public void Clear() { File.Delete(zipLoc); } }

Viewing all articles
Browse latest Browse all 2891

Trending Articles