x


Runtime loaded assemblies

I am having an issue with runtime loaded C# assemblies. I am packing code into AssetBundles by separately compiling it using Mono's complier into an assembly and then placing the assembly bytecode in a custom asset in the asset bundle.

My problems start if I use the assembly that unity produces (Assembly-CSharp.dll) for the project as a reference for my dll. Unity builds the project assembly using a random hash as the file name and then renames it to Assembly-CSharp.dll. The hash however gets stored internally as the assembly name. This hash changes every time, so when I load my assembly it looks for the original assembly name and doesn't find it. This means that I have to rebuild my assembly and rebuild the asset bundles every time Unity rebuilds the Assembly-CSharp.dll.

Is there any way around this? To force unity to use a constant name when building Assembly-CSharp.dll?

more ▼

asked Jan 20 '11 at 05:21 PM

S.Kulczycki gravatar image

S.Kulczycki
37 1 1 4

Could post some more information or a couple of links about the Mono compiler / embed assembly / dynamically load. I want to do the same thing and was hoping for some help.

Mar 17 '11 at 04:17 AM AIResearcher
(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

K, fixed this by registering to the AppDomain.CurrentDomain.AssemblyResolve event before loadin the assemblies and redirecting the request there.

more ▼

answered Jan 21 '11 at 02:09 PM

S.Kulczycki gravatar image

S.Kulczycki
37 1 1 4

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

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

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x533
x382
x180
x108
x46

asked: Jan 20 '11 at 05:21 PM

Seen: 1912 times

Last Updated: Jan 20 '11 at 05:21 PM