Need help fixing a script thanks in advance :)

Updated on September 16, 2014 in [A] Unity Scripting
Share on Facebook0Tweet about this on TwitterShare on Google+0Share on Reddit0
6 on September 13, 2014

okay i have an empty object that produces a random object it works but i keep getting an error when editing other scripts and saving ill post it all now so you can see

 

using UnityEngine;
 using System.Collections;
 public class ProduceRandomObj : MonoBehaviour
 {
 public GameObject[] objects;
 public GameObject emptyObject;
 public int numberOfPlacedObj = 0;
 public int randomNum;
 void Start ()
 {
 if(numberOfPlacedObj <= 1)
 {
 GameObject newObject;
 randomNum = Random.Range(1, 36);
 newObject = (GameObject)Instantiate(objects[randomNum], emptyObject.transform.position, Quaternion.Euler(270,0,0));
 Destroy(emptyObject);
 numberOfPlacedObj++;
 }
 }
 }

so basicly it picks a random number then transforms the empty object to the new item.

[b]here the error[/b]

Assets/C# Scripts/ProduceRandomObj.cs(16,36): warning CS0219: The variable `newObject’ is assigned but its value is never used – this error is the normal error

[b]here it is again when it stops me playing or building game[/b]

Internal compiler error. See the console log for more information. output was:Assets/C# Scripts/ProduceRandomObj.cs(16,36): warning CS0219: The variable `newObject’ is assigned but its value is never used

Unhandled Exception: System.UnauthorizedAccessException: Access to the path “C:\Users\splet_000\Documents\Tasteless Marble Maze 3D\Temp\Assembly-CSharp.dll.mdb” is denied.

at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options) [0x00000] in :0

at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean isAsync, Boolean anonymous) [0x00000] in :0

at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access) [0x00000] in :0

at Mono.CompilerServices.SymbolWriter.MonoSymbolWriter.WriteSymbolFile (Guid guid) [0x00000] in :0

at Mono.CSharp.SymbolWriter+SymbolWriterImpl.WriteSymbolFile () [0x00000] in :0

at Mono.CSharp.SymbolWriter.WriteSymbolFile () [0x00000] in :0

at Mono.CSharp.CodeGen.Save (System.String name, Boolean saveDebugInfo, Mono.CSharp.Report Report) [0x00000] in :0

at Mono.CSharp.Driver.Compile () [0x00000] in :0

at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in :0

what can i do to fix this problem 🙂

  • Liked by
Reply
0 on September 15, 2014

can any one help with this problem? or is there something wrong with my unity? because iv be getting messages saying you cannot access that script some of the time which i have to edit a script save it then fix it to get it back to normal i dont understand it my self.

  • Liked by
Reply
Cancel
1 on September 15, 2014

if you have internal compiler error, =thoose are very hard to fix because it basically meaning the the compiler is having a problem not your script

Helpful
on September 16, 2014

so its mono development having trouble or unity?

Show more replies
  • Liked by
Reply
Cancel
0 on September 16, 2014

See this? 

Unhandled Exception: System.UnauthorizedAccessException: Access to the path “C:\Users\splet_000\Documents\Tasteless Marble Maze 3D\Temp\Assembly-CSharp.dll.mdb” is denied.

Navigate to that Temp folder, and delete everything.

Good luck.

  • Liked by
Reply
Cancel
1 on September 16, 2014

When I was scripting pawno that generally meant you’ve missed a closing bracket and it just had a mental breakdown. However I do believe that the mono compiler gives you a specific error for that circumstance. May pay just to give it a look over though.

Helpful
on September 16, 2014

all the scripts are fine i do believe it is something to do with what mega said 🙂 thanks for your post tho 🙂

Show more replies
  • Liked by
Reply
Cancel