Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by Cscotttaakan · Sep 16, 2011 at 05:42 AM · errormono

System Unauthorized

Hello, I have run into some problems in mono. I try and debug the program, and no matter what, it comes up with the same error; Error Error: System.UnauthorizedAccessException: Access to the path 'C:\Users\Craig' is denied. (Error: System.UnauthorizedAccessException) (Assembly-UnityScript-firstpass). The interesting thing is, that folder "Craig" wasn't even created! It looks for the folder, but its not there! I created one to try and circumvent it, but it just said it didn't have access to it. I'm not sure why its doing this. Any help would be appreciated.

Thanks! Craig

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image syclamoth · Sep 16, 2011 at 06:42 AM 1
Share

Well, if the folder doesn't exist, then that's a good reason why the program can't find it! Find out what part of your program is trying to access this folder, and go from there.

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by clunk47 · Dec 09, 2012 at 04:48 AM

Here's a fairly simple script I wrote for you to try out. I have tested and it works. This is a C# script. Let me know if you have any issues and I will resolve them for you. Copy the code below and paste into a new C-Sharp Script named FileTest. Be sure to use : using System.IO when dealing w/ Directory and File objects. This script will check for the directory and file. If something doesn't exist, this script will create it. If the file doesn't exist, the GUI Button will read "Create File". Once you click on the button, it will create the directory and file, then it will read "Write to file". Once you click on the button again, it will write a string to the txt file and open the file with the new appended text.

 using System.IO;
 using System.Collections;
 using UnityEngine;
 
 public class FileTest : MonoBehaviour
 {
     string ButtonText;
     
     void Update()
     {
         if(!File.Exists("C:/Users/Craig/Test.txt"))
             ButtonText = "Create File";
         else if(File.Exists("C:/Users/Craig/Test.txt"))
             ButtonText = "Write To File";
     }
     
     void OnGUI()
     {
         if(GUI.Button (new Rect(200, 200, 128, 30), ButtonText))
         {
             if(!Directory.Exists("C:/Users/Craig"))
             {
                 Directory.CreateDirectory("C:/Users/Craig");
                 File.Create("C:/Users/Craig/Test.txt");
             }
             else if(Directory.Exists("C:/Users/Craig") && !File.Exists("C:/Users/Craig/Test.txt"))
                 File.Create("C:/Users/Craig/Test.txt");
             else if(Directory.Exists("C:/Users/Craig") && File.Exists("C:/Users/Craig/Test.txt"))
             {
                 File.WriteAllText("C:/Users/Craig/Test.txt", "Damn, Bro, you just created a file and wrote this text to it :D");
                 System.Diagnostics.Process.Start ("C:/Users/Craig/Test.txt");
             }
         }
     }
 }
Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

The requested feature is not implemented 1 Answer

Unity wont launch 1 Answer

Internal Compiler Error 3 Answers

MonoDevelop Unhandled Exception. MonoDevelop will now close - Mac OSX 1 Answer

Mono Develop start 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges