- Home /
failed to create file? (trying to create a launcher.) Failed To create File.
Ok so i've been trying to create my own game launcher, shouldn't be that hard :) www download and save a folder from my webserver and save it to the folder that my launcher is in then Launch the game. this is the error print I am getting can anyone tell me whats wrong? )
MyLogFile:
Begin MonoManager ReloadAssembly - Completed reload, in 0.992 seconds Initializing input.
Input initialized.
Initialized touch support.
UnloadTime: 0.712412 ms ArgumentException: Failed to create file C:/Users/zak/Desktop/DarkDivide/Launcher/Launcher_Data at (wrapper managed-to-native) UnityEngine.Networking.DownloadHandlerFile.Create(UnityEngine.Networking.DownloadHandlerFile,string,bool) at UnityEngine.Networking.DownloadHandlerFile.InternalCreateVFS (System.String path, System.Boolean append) [0x0001e] in C:\buildslave\unity\build\Modules\UnityWebRequest\Public\DownloadHandler\DownloadHandler.bindings.cs:232 at UnityEngine.Networking.DownloadHandlerFile..ctor (System.String path) [0x0000a] in C:\buildslave\unity\build\Modules\UnityWebRequest\Public\DownloadHandler\DownloadHandler.bindings.cs:237 at DonloadGameUpdate+d__10.MoveNext () [0x00036] in C:\Users\zak\Documents\Galactic-Divide-MMO\Assets\Scripts\DonloadGameUpdate.cs:79 at UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) [0x00027] in :0 UnityEngine.MonoBehaviour:StartCoroutineManaged2(IEnumerator) UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator) DonloadGameUpdate:Start() (at C:\Users\zak\Documents\Galactic-Divide-MMO\Assets\Scripts\DonloadGameUpdate.cs:23)
(Filename: Line: 0)
Setting up 2 worker threads for Enlighten. Thread -> id: 37ec -> priority: 1 Thread -> id: 3c84 -> priority: 1
MY CS Script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using System.Diagnostics;
using System.IO;
using UnityEngine.Networking;
public class DonloadGameUpdate : MonoBehaviour
{
float Download;
float DownloadMAx = 100;
public Image DownloadBarPercent;
public string GameToLoadEXEPath;
public bool UpdateDownloaded;
public string GameURLDownload;
public void Start()
{
GameToLoadEXEPath = Application.dataPath; /// where my game has been installed....
DownloadingUpdateYay();
Main(); // Delete Old Game Folder.....
StartCoroutine(DownloadingUpdateYay());
}
public static void Main()
{
var hi = Directory.GetFiles(Application.dataPath + "/Build");
for (int i = 0; i < hi.Length; i++)
{
File.Delete(hi[i]);
}
}
// Update is called once per frame
void Update()
{
DownloadBarPercent.fillAmount = Download / DownloadMAx;
}
private IEnumerator DownloadingUpdateYay()
{
yield return DownloadNewVersion();
if (!UpdateDownloaded)
{
print("Downloaing....");
}
else
{
Process mProcess = new Process();
mProcess.StartInfo.FileName = GameToLoadEXEPath + "/Build.exe"; // Path to load here....
mProcess.Start();
Application.Quit();
}
}
// downlaod New Version of Game ;).........
private IEnumerator DownloadNewVersion()
{
var uwr = new UnityWebRequest(GameURLDownload);
uwr.downloadHandler = new DownloadHandlerFile(GameToLoadEXEPath);
yield return uwr.SendWebRequest();
if (uwr.isNetworkError || uwr.isHttpError)
print("Error downloading your Game....");
else
print("GAME DOWNLOWNED....");
}
}
Your answer

Follow this Question
Related Questions
Need help In creating android game with UI buttons ?Please Help 1 Answer
Scripts not updating the material's shader properties 1 Answer
Flip between 2 states constantly C#? 1 Answer
In-Game Tutorial with special actions in special areas. (Shooter) 0 Answers
why if i load a level with ServerChangeScene there spawn dozens of scenes 0 Answers