Getting this error but I don't know what it means. Version 3.0.1F Code (csharp): VerificationException: Error verifying AccelerometerBehaviourScript/<Start>c__Iterator11:MoveNext (): Cannot call a non-final virtual method from an objet diferent thant the this pointer at 0x00a3
This might actually be a scripting question. Are you getting this error at runtime or in the editor? Do you have a script called AccelerometerBehaviourScript in your project? If so, can you post it?
I have the same error but only if I select Web Player as Build Plataform. :S This is the warning http://msdn.microsoft.com/en-us/library/ms228459(VS.80).aspx, according to this, the solution is to use a helper function. What I still understanding is why it works in a Standalone build....Course, 'cause is unsafe code, and that is not allowed in webplayer. Basically my code looks like this... Code (csharp): public override IEnumerator Disable() { yield return StartCoroutine( base.Disable() ); } I did a "fake" disable function in the base class called BaseDisable, yield return StartCoroutine( BaseDisable() ). Works but still doesn't like it, hope anyone else has a solution.
Thats no unsafe code as thats not possible with Unity. What the error tried to explain you is that you have unverifyable code (thats not the same as unsafe as unsafe is in relation to .NET <-> native unmanaged code), which for example is created through using var xxxx instead of true type declarations and alike and then calling such stuff up the inheritance chain in a more general context. That will not work. also, you can naturally not call any base function thats virtual up the inheritance chain, which given you have override there, might very well be the case here. If you have a real function there, leave it as real function and declare the one here as public new IEnumerator Disable() for example
I'd love to take a look at this problem. It's either a bug in Mono's verifier, or it's a genuine problem with your code. Could you file a bug report with the exact sourcecode that is causing this failure, and ask for the bug to be assigned to me? Thanks, Lucas
If you are refering to me, I just did a little example project ( http://www.megaupload.com/?d=CZBQCIBM ). If can file it if you need to, I just didn't do it 'cause wasn't sure who you are talking to
Sorry to dig up an old thread but I had the same problem and found a solution (sorta). Background: My friend was building for an iOS. Zipped up the entire project and sent it to me. I'm on a PC. Typically when I open the project it will switch it to PC and Mac standalone but this time it switched it to Web player. To make the error go away I switched it to PC and Mac standalone.
I have the same issue, I use coroutines and virtual methods. The project is initially created for mobile platforms and now i'm going to port it to webplayer. So what is the core of the issue and what a solution/workaround exists?
I still get this error. I think polimorphism is not working for coroutines. I have the latest version of unity 3 installed and the error along with the grammar mistake is still there. Stack trace: VerificationException: Error verifying SpiderWalker/<AvoidRock>c__Iterator34:MoveNext (): Cannot call a non-final virtual method from an objet diferent thant the this pointer at 0x00d8 UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator) And code in my class that produces this is something like this: Code (csharp): Class A{ public virtual IEnumerator DoSmth(){ } } Class B : Class A { public override IEnumerator DoSmth(); } RunnCode: //The object is of actual type ClassB classA = gameObject.GetComponent<ClassA>(); StartCoroutine(ClassA.DoSmth());
I'm running into this same issue. Works fine when platform is set to iOS but has this runtime error when platform is web. I actually have the classes nested 3 levels so its even more of a pain to fix with 'fake' methods. And whats up with the misspellings in the exception? [edit] FYI: this is with 4.0.1f2 in my case I have: Code (csharp): class A : MonoBehaviour { public virtual Coroutine foo { return StartCoroutine(A_DoStuff()); } private IEnumerator A_DoStuff() { ... } } class B : A { public override Coroutine foo { return StartCoroutine(B_DoStuff()); } private IEnumerator B_DoStuff() { yield return base.foo(); DoMoreStuff(); } } // which is run like: // B test = new B(); // test.foo; and that gives this exception. I've tried doing new rather than override/virtual and that didn't help. Not sure why the web version is different from iOS? Is this just an old bug that was left in in the web version? [edit] ooooooohhhhh its because the web player is a partial trust environment... and somehow there's some unverifiable code when doing this with coroutines... blarg. I guess I'll have to make my codes ugly with helper functions.
I am seeing the exact same bug for the exact same reason. I thought it was my fault because the exception was misspelled, but that exception is being spit out by the run-time environment not, my own code. The only way I have found to deal with this is to make the base class's function an Abstract function() with no body, and a base_function() with the body i wanted. In the derived classes i call base_function(): instead of base.function()
I'm working on a web application. I have a fairly deep inheritance tree and at the very bottom I have: Code (csharp): /// <summary> /// Gets the metadata. /// </summary> /// <returns>The metadata.</returns> public abstract IEnumerable<BaseMetadata> GetMetadata(); /// <summary> /// Calls update on metadata. /// </summary> private void UpdateMetadata() { foreach (BaseMetadata item in GetMetadata()) item.Update(); } This has caused Unity to throw the error: VerificationException: Error verifying Assets.Scripts.Designs.Concrete.Menus.Forms.LoginMenuDesign/<GetMetadata>c__Iterator16:MoveNext (): Cannot call a non-final virtual method from an objet diferent thant the this pointer at 0x003a It's disheartening to see the typo hasn't been corrected in 4 years, let alone the error itself. This also suggests the error isn't unique to coroutines.
I just got this same funnily spelled exception in the Editor scripts, and only with the Web Player as target. It has something to do with virtual iterator methods, and not with the coroutines only. Anyone knows of some workaround?
It turned out calling a virtual function using the base keyword inside the method body of an iterator or anonymous function is not allowed in partial trust environment, such as in Web Player. I was calling the base implementation from a virtual iterator and fortunately that call was unnecessary so I just removed it and it works fine now.
I ran into this situation twice, two different scenarios: 1) Webplayer throws an exception when a class inherits from a base class and defines a protected child class which inherits from a protected child of the base class and the constructor is called: http://forum.unity3d.com/threads/webplayer-inheritance-bug.256169/ 2) Private nested child classes trying to access a method in a private class declared in the parent. Again, webplayer-only problem. Band-aid "solution" - make the private class declared in the parent internal.