Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Every C# script is throwing errors on the console

Tags:

c#

unity3d

I've just created an Unity project with a clean installation, also created a C# script and attached to a 3D Game Object (Cube), but when I double-click to open the script it instantly says:

Exception thrown while invoking [OnOpenAssetAttribute] method 'Unity.CodeEditor.CodeEditor:OnOpenAsset (int,int,int)' : InvalidOperationException: Cannot start process because a file name has not been provided.
System.Diagnostics.Process.Start () (at <d465e2b2e5054d2787d6364114c43446>:0)
(wrapper remoting-invoke-with-check) System.Diagnostics.Process.Start()
UnityEditor.DefaultExternalCodeEditor.OpenProject (System.String path, System.Int32 line, System.Int32 column) (at C:/buildslave/unity/build/Editor/Mono/CodeEditor/DefaultExternalCodeEditor.cs:96)
Unity.CodeEditor.CodeEditor.OnOpenAsset (System.Int32 instanceID, System.Int32 line, System.Int32 column) (at C:/buildslave/unity/build/Editor/Mono/CodeEditor/CodeEditor.cs:56)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

and

InvalidOperationException: Cannot start process because a file name has not been provided.
System.Diagnostics.Process.Start () (at <d465e2b2e5054d2787d6364114c43446>:0)
(wrapper remoting-invoke-with-check) System.Diagnostics.Process.Start()
UnityEditor.DefaultExternalCodeEditor.OpenProject (System.String path, System.Int32 line, System.Int32 column) (at C:/buildslave/unity/build/Editor/Mono/CodeEditor/DefaultExternalCodeEditor.cs:96)
Unity.CodeEditor.CodeEditor.OpenFileAtLineColumn (System.String path, System.Int32 line, System.Int32 column) (at C:/buildslave/unity/build/Editor/Mono/CodeEditor/CodeEditor.cs:31)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

And if I, for example, try to use Debug.Log in the script, it says

'Debug' does not contain a definition for 'Log'

Nothing works.

I've already tried to reopen unity, create another project, install another version (I'm now using the latest 2019.2.0b1) and this always happens, I'm using Visual Studio and the errors are prompted in the Unity console.

like image 913
Diego Vinicius Avatar asked May 15 '19 01:05

Diego Vinicius


People also ask

What does %c mean in C?

%d is used to print decimal(integer) number ,while %c is used to print character . If you try to print a character with %d format the computer will print the ASCII code of the character.

What is C -- used for?

C-- is a "portable assembly language", designed to ease the implementation of compilers that produce high-quality machine code. This is done by delegating low-level code-generation and program optimization to a C-- compiler.

What are the C keywords?

Keywords are predefined, reserved words used in programming that have special meanings to the compiler. Keywords are part of the syntax and they cannot be used as an identifier.


1 Answers

The solution was to set Visual Studio as the default editor of Unity, as someone in the comment section said.

like image 156
Diego Vinicius Avatar answered Oct 20 '22 00:10

Diego Vinicius