- Home /
Can you use yield and Try/catch in the same function?
I'm interested to know whether I should be able to use a try/catch sequence in the same function that I use yield?
[edit] I am coding in Javascript.
Every time I inadvertantly code one I get the following error on the line containing:
catch(e)
the error:
Assets/My Assets/My Scripts/TextureController.js(93,25): BCE0055: Internal compiler error: Object reference not set to an instance of an object.
so some object reference error to do with the catch statement????
If I take all the yield statements out of the function it compiles fine.
every other case where I use try/catch (without yield) it works fine.
Also - the yield statements are outside the body of the try/catch.
Any clues?
Answer by Mike 3 · Aug 02, 2010 at 11:27 AM
It seems to be a UnityScript/JavaScript compiler bug - I can code the exact same thing in c# without any issues
I would bug report it immediately, it's a pretty bad one