# Dynamically loading Assembly in Web Player

**URL:** https://discussions.unity.com/t/dynamically-loading-assembly-in-web-player/28179
**Category:** Questions & Answers
**Created:** [September 9, 2011, 3:18am UTC](https://discussions.unity.com/t/dynamically-loading-assembly-in-web-player/28179 "2011-09-09T03:18:03Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![anon57420914](https://avatars.discourse-cdn.com/v4/letter/a/43a26b/32.png) [@anon57420914](https://discussions.unity.com/u/anon57420914)
#### Post date: [September 9, 2011, 3:18am UTC](https://discussions.unity.com/t/dynamically-loading-assembly-in-web-player/28179/1 "2011-09-09T03:18:03Z")

</div>

Hi all,

Within the editor, I am able to download a .dll using WWW, and instantiate classes from it with Assembly.CreateInstance(…).

When going to the web player, I see the following error in the log (my class/method names scrubbed to protect the innocent :)):

```
MethodAccessException: Attempt to access a private/protected method failed.
  at System.Security.SecurityManager.ThrowException (System.Exception ex) [0x00000] in <filename unknown>:0 
  at MyClass.myMethod (.Game game) [0x00000] in <filename unknown>:0 
  at StartLevel.Update () [0x00000] in <filename unknown>:0 

```

Is this possible in the web player? Is there a different/better method?

* * *

**Here is the solution that is working for me:**

- Download and load your Assembly with WWW

- Use the following code to load and instantiate a class from within that Assembly:

(Sorry, I can’t seem to get that to format as code for some reason with leading spaces)

---

<div class="post-metadata">

### Author: ![jonas-echterhoff](https://avatars.discourse-cdn.com/v4/letter/j/3bc359/32.png) [@jonas-echterhoff](https://discussions.unity.com/u/jonas-echterhoff)
#### Post date: [September 9, 2011, 10:17am UTC](https://discussions.unity.com/t/dynamically-loading-assembly-in-web-player/28179/2 "2011-09-09T10:17:18Z")

</div>

While I’m not quite sure why `Assembly.CreateInstance` would not be allowed in the web player, you should be able to use `Assembly.Load`. See the “Including scripts in AssetBundles” example [here](http://unity3d.com/support/documentation/Manual/AssetBundles.html).
