How do I identify the offending method for "attempt to access a private/protected method failed"?

I know that this exception is thrown because I’m calling some method that’s prohibited by the webplayer security sandbox. My problem is, the callstack in the exception only tells me in which function the offending call resides (in this case, that’s MonoBehaviour.Awake), but not what the offending call actually is. This particular function does rather a lot of stuff, and there’s a whole smorgasboard of calls that may or may not be the one in question.

Is there any way to get more information about which particular call is failing? Or do i just need to start binary-searching my way through the function, commenting out chunks and rebuilding the web player eleven million times? :frowning:

Well that just tells me that your function just contains too much code. Simply break it up into multiple meaningful sub methods. That way you get a proper stack trace. Without seeing you code it’s impossible to say what you do wrong here.

Do you use any plugins / DLLs?

I ended up just commenting out most of the function and slowly adding bits back in, rebuilding the web player each time, until the exception occurred. Kind of a silly workflow, but I was able to identify the offending function – Assembly.GetName(), of all things – and work around the issue such that the web player build works properly.

It would be really nice if that exception actually listed the method call that threw the exception, rather than just the name of the containing function. Really nice indeed. :expressionless: