Hi. I installed Unity and started learning Unity just the day before yesterday.
I’m a beginner of C#, so I read Roll-a-ball tutorial and made a project following it.
However the C# script for the player object receives the error “No Monobehaviour scripts in the file, or their names do not match the file name”.
As a test I downloaded the demo project “Mecanim GDC2013 Sample Project” and opened it in Unity.
It also received the same error for all scripts in this project and I can’t enter playmode. Even a new script which created by Create → C# script at Project tab menu has same error.
I googled forums and tried to take some measures but nothing has been solved. Tried:
-
Check the file name and the class name
-
Remake the script file
-
Re-import the script file
-
Delete Japanese comments
-
Change character code(UTF-8 / UTF-8 with BOM / UTF-16 LE / UTF-16 LE with BOM)
-
Re-install Unity
“No monobehaviour scripts in the file” even on new scripts? - Unity Answers
Scripts saying there is no MonoBehavior Script on file - Unity Answers
Unity 5- “no Monobehaviour scripts in the file” message - Unity Answers
Roll-a-ball Script Refuses to accept Monobehaviour - Unity Answers
The tutorial is written in Japanese but the contents are almost same as English one, maybe.
Home · unity3d-jp/FirstTutorial Wiki · GitHub
I’m using Unity 5.3.3f1 Personal on Mac OSX v10.8.5.
If you have any solutions, please let me know. And if you have any questions about my situation, I’ll answer it as much as I can.
Sorry for my poor English!
Screenshot:
Console:
Stacktrace:
at (wrapper managed-to-native) System.Reflection.Emit.ModuleBuilder.WriteToFile (intptr) <0x00004>
at (wrapper managed-to-native) System.Reflection.Emit.ModuleBuilder.WriteToFile (intptr) <0x00004>
at System.Reflection.Emit.ModuleBuilder.Save () <0x00643>
at System.Reflection.Emit.AssemblyBuilder.Save (string,System.Reflection.PortableExecutableKinds,System.Reflection.ImageFileMachine) <0x00658>
at Mono.CSharp.CodeGen.Save (string,bool,Mono.CSharp.Report) <0x00093>
at Mono.CSharp.Driver.Compile () <0x00d03>
at Mono.CSharp.Driver.Main (string) <0x0008f>
at (wrapper runtime-invoke) .runtime_invoke_int_object (object,intptr,intptr,intptr) <0x00043>
Native stacktrace:
0 libsystem_kernel.dylib 0x007643ba __kill + 10
1 libsystem_c.dylib 0x006726fd raise + 26
2 mono 0x0033a3ea g_assertion_message + 122
3 mono 0x0033a2d1 g_logv + 257
4 mono 0x0033a35b g_log + 59
5 mono 0x00285e69 mono_image_create_pefile + 12425
6 mono 0x00283dba mono_image_create_pefile + 4058
7 mono 0x001e35e4 mono_register_jit_icall + 60052
8 ??? 0x04a1fd27 0x0 + 77724967
9 ??? 0x04a1f7cc 0x0 + 77723596
10 ??? 0x04a1a2f1 0x0 + 77701873
11 ??? 0x04a19a6c 0x0 + 77699692
12 ??? 0x013f2a34 0x0 + 20916788
13 ??? 0x013c22a8 0x0 + 20718248
14 ??? 0x013c262c 0x0 + 20719148
15 mono 0x00011c6f mono_get_runtime_build_info + 6831
16 mono 0x0025f560 mono_runtime_invoke + 208
17 mono 0x0026a6b4 mono_runtime_exec_main + 836
18 mono 0x0026a34f mono_runtime_run_main + 543
19 mono 0x000b752e mono_jit_exec + 286
20 mono 0x000bace7 mono_main + 13959
21 mono 0x000b9762 mono_main + 8450
22 mono 0x00001a40 main + 64
23 mono 0x000019b5 start + 53
Debug info from gdb:
=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
WriteFile returned 25