Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Shawn · Jan 21, 2010 at 05:43 PM · iphonebuild-errorexceptionscriptdoesntmatchclass

Mono Error when compiling scripts

Hey guys, I am getting a strange error when attempting to compile my project. This project used to compile just fine until I was trying to merge some assets using the Import/Export package functionality and a few of my resources were replaced (no prompt for replacing assets btw...). I managed to recover all the scripts that were replaced and I have the project compiling into a dll just fine in VS2008 Express but when I attempt to re-import the scripts in Unity I get the following error:

Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object at Mono.CSharp.Argument.Emit (Mono.CSharp.EmitContext ec) [0x00000] at Mono.CSharp.Invocation.EmitArguments (Mono.CSharp.EmitContext ec, System.Reflection.MethodBase mb, System.Collections.ArrayList arguments, Boolean dup_args, Mono.CSharp.LocalTemporary this_arg) [0x00000] at Mono.CSharp.Invocation.EmitCall (Mono.CSharp.EmitContext ec, Boolean is_base, Mono.CSharp.Expression instance_expr, System.Reflection.MethodBase method, System.Collections.ArrayList Arguments, Location loc, Boolean dup_args, Boolean omit_args) [0x00000] at Mono.CSharp.PropertyExpr.EmitAssign (Mono.CSharp.EmitContext ec, Mono.CSharp.Expression source, Boolean leave_copy, Boolean prepare_for_load) [0x00000] at Mono.CSharp.Assign.Emit (Mono.CSharp.EmitContext ec, Boolean is_statement) [0x00000] at Mono.CSharp.Assign.Emit (Mono.CSharp.EmitContext ec) [0x00000] at Mono.CSharp.Conditional.Emit (Mono.CSharp.EmitContext ec) [0x00000] at Mono.CSharp.Argument.Emit (Mono.CSharp.EmitContext ec) [0x00000] at Mono.CSharp.Invocation.EmitArguments (Mono.CSharp.EmitContext ec, System.Reflection.MethodBase mb, System.Collections.ArrayList arguments, Boolean dup_args, Mono.CSharp.LocalTemporary this_arg) [0x00000] at Mono.CSharp.Invocation.EmitCall (Mono.CSharp.EmitContext ec, Boolean is_base, Mono.CSharp.Expression instance_expr, System.Reflection.MethodBase method, System.Collections.ArrayList Arguments, Location loc, Boolean dup_args, Boolean omit_args) [0x00000] at Mono.CSharp.PropertyExpr.EmitAssign (Mono.CSharp.EmitContext ec, Mono.CSharp.Expression source, Boolean leave_copy, Boolean prepare_for_load) [0x00000] at Mono.CSharp.Assign.Emit (Mono.CSharp.EmitContext ec, Boolean is_statement) [0x00000] at Mono.CSharp.Assign.EmitStatement (Mono.CSharp.EmitContext ec) [0x00000] at Mono.CSharp.StatementExpression.DoEmit (Mono.CSharp.EmitContext ec) [0x00000] at Mono.CSharp.Statement.Emit (Mono.CSharp.EmitContext ec) [0x00000] at Mono.CSharp.Block.DoEmit (Mono.CSharp.EmitContext ec) [0x00000] at Mono.CSharp.Block.Emit (Mono.CSharp.EmitContext ec) [0x00000] at Mono.CSharp.Switch.TableSwitchEmit (Mono.CSharp.EmitContext ec, System.Reflection.Emit.LocalBuilder val) [0x00000] at Mono.CSharp.Switch.DoEmit (Mono.CSharp.EmitContext ec) [0x00000]

I also noticed this section in the Editor.log

Couldn't load the script "Game" because its file name doesn't match the class name. Please make sure the file name of the script is the same as the class defined inside it. (Filename: /Users/build/builds/unity-iphone-1.5/iphone-1.1/Projects/../Runtime/Mono/MonoScript.cpp Line: 410)

I went and double checked the Game.cs script file and and it has a class named "Game" which inherits from the MonoBehaviour class. It has this same error for every other script in the project as well.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by Shawn · Jan 21, 2010 at 06:40 PM

Had a typo in an inline condition which caused the above crash.

SettingsManager.MusicVolume = (SettingsManager.MusicVolume > 0) ? SettingsManager.MusicVolume = 0 : SettingsManager.MusicVolume = 0.5f;

should have been

SettingsManager.MusicVolume = (SettingsManager.MusicVolume > 0) ? 0 : 0.5f;

Must have been day dreaming while writing that :). Strange that it would kill the compiler though. It does not even cause an error or warning inside of VS2008. Must be a bug in the older version of Mono.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Lucas Meijer 1 ♦♦ · Jan 21, 2010 at 11:02 PM 0
Share

If you still have the script that makes mono's compiler crash, we'd love to get it (Unitymenu->help->report a problem), so we can make sure that the problem is really gone when we put in a new mono.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

No one has followed this question yet.

Related Questions

BuildPipeline.BuildPlayer misnames .pbxuser file 3 Answers

Why can't I build Web Player in Unity while I have no problems with building standalone versions? 2 Answers

Get error on iPhone (Sealed Class) when trying to build iOS Game for Windows 1 Answer

How can I stop the variable values reverting to its default values after being built? 1 Answer

ExecutionEngineException: Attempting to JIT compile method 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges