- Home /
how do I save a script when access is denied?
So part way through a tutorial for the beginner project "Roll-a-ball" and I'm trying to save the script it just had me write, and I'm being told access is denied. I have full permissions for everything. However, when I look at the properties for the fold of my project, it is marked "read-only". Even when I check this off it comes back on, not sure if that is my problem or not because it won't stay off. Any advice or assistance would be greatly appreciated.
Also, it tells me to check console log for more information, I can't seem to find that.
Here is the text for the error:
System.UnauthorizedAccessException: Access to the path 'C:\Users\alex\Desktop\Project 1(ball game)\Assets\Scripts.#PlayerController.cs' is denied.
at
System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String
path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at
System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
at
Mono.TextEditor.Utils.TextFileUtility.WriteText(String fileName, String text, Encoding encoding, Boolean hadBom) in c:\BuildAgent\work\d478831d940d36a4\monodevelop\main\src\core\Mono.Texteditor\Mono.TextEditor.Utils\TextFileUtility.cs:line 184
at
MonoDevelop.SourceEditor.SourceEditorView.Save(String fileName, Encoding encoding) in c:\BuildAgent\work\d478831d940d36a4\monodevelop\main\src\addins\MonoDevelop.SourceEditor2\MonoDevelop.SourceEditor\SourceEditorView.cs:line 672
at
MonoDevelop.SourceEditor.SourceEditorView.Save(String fileName) in c:\BuildAgent\work\d478831d940d36a4\monodevelop\main\src\addins\MonoDevelop.SourceEditor2\MonoDevelop.SourceEditor\SourceEditorView.cs:line 588
at
MonoDevelop.Ide.Gui.Workbench.OnWindowClosing(Object sender, WorkbenchWindowEventArgs args) in c:\BuildAgent\work\d478831d940d36a4\monodevelop\main\src\core\MonoDevelop.Ide\MonoDevelop.Ide.Gui\Workbench.cs:line 719
The immediate advice would be to just select all and paste into Notepad/other text editor. Presumably you've already tried right clicking on the folders and un-ticking the read-only option
When creating anything new with Unity, immediately after creating the project and a scene, save it all.
Log files are located...
http://docs.unity3d.com/$$anonymous$$anual/LogFiles.html
In some cases, it might not be Unity which is the cause; see also:
http://answers.unity3d.com/questions/599325/giving-me-a-systemunauthorizedaccessexception-ever.html
Ok, after deactivating my virus protection and removing the requirement for permissions I am still having a problem saving my script. In Unity it is saying "internal compiler error" but still in mono it is saying that it doesn't have access. I have even ran both in ad$$anonymous$$istration mode and still not helping.
I am still running into this same problem after multiple solution look ups. none have worked. someone please help. Not sure if this will help but in monodevelop when I try to save this is the error it gives.
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.UnauthorizedAccessException: Access to the path 'C:\Users\$$anonymous$$ackenzie\Desktop\Space Shooter\Assets\Scripts\.#PlayerController.cs' is denied.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, File$$anonymous$$ode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, File$$anonymous$$ode mode, FileAccess access, FileShare share)
at $$anonymous$$ono.TextEditor.Utils.TextFileUtility.WriteText(String fileName, String text, Encoding encoding, Boolean hadBom)
at $$anonymous$$onoDevelop.SourceEditor.SourceEditorView.Save(String fileName, Encoding encoding)
at $$anonymous$$onoDevelop.SourceEditor.SourceEditorView.Save(String fileName)
at $$anonymous$$onoDevelop.Ide.Gui.Document.Save()
at $$anonymous$$onoDevelop.Ide.Gui.ViewCommandHandlers.OnSaveFile()
--- End of inner exception stack trace ---
at System.Runtime$$anonymous$$ethodHandle.Invoke$$anonymous$$ethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.Runtime$$anonymous$$ethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.Runtime$$anonymous$$ethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.$$anonymous$$ethodBase.Invoke(Object obj, Object[] parameters)
at $$anonymous$$onoDevelop.Components.Commands.CommandHandlerInfo.Run(Object cmdTarget, Command cmd)
at $$anonymous$$onoDevelop.Components.Commands.Command$$anonymous$$anager.<>c__DisplayClassb.<DispatchCommand>b__2()
at $$anonymous$$onoDevelop.Components.Commands.Command$$anonymous$$anager.DispatchCommand(Object commandId, Object dataItem, Object initialTarget, CommandSource source)
Your answer
![](https://koobas.hobune.stream/wayback/20220613172213im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Error trying to open script with Monodevelop 3 Answers
How do I get set up with a programming language and everything. 2 Answers
Help With "Scripting" 1 Answer
How to get step sound using axis.x movement 2 Answers
Cant get Monodevolop to work 0 Answers