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.
%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.
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.
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.
The solution was to set Visual Studio as the default editor of Unity, as someone in the comment section said.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With