0

Is it possible to run different versions of Unity within an app?

I m referencing an app which uses an old version of unity and the current version of unity i m using the newest version.

I get this warning .

I tried what the posts suggested but didnt work out.

How to get this working?

THanks.

Community
  • 1
  • 1
DarthVader
  • 52,984
  • 76
  • 209
  • 300

1 Answers1

0

The compile-time warning is just that, a warning. You can ignore it so long as you have both versions of the Unity DLL available to the application. You can achieve this by editing your App.config to look something like this

<runtime>
  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <dependentAssembly>
      <assemblyIdentity name="Unity" publicKeyToken="605f591b87e816bd"/>
      <codeBase version="1.0.0.0" href="./v1/Unity.dll"/>
      <codeBase version="2.0.0.0" href="./v2/Unity.dll"/>
    </dependentAssembly>
  </assemblyBinding>
</runtime>

This is just pseudo-config, but you can see that under my applications 'bin' directory, I will have a subdirectory for both versions of Unity. This config basically says to the .net runtime, "When you need either version 1, or 2 of unity, you can obtain them from these subdirectories".

Of course, whether or not you SHOULD do this is another story. If you have any loose config (such as xml) in your application which reference types within the Unity DLL - those 'references' will need to specify the version-qualified-strong-name of the Unity DLL, otherwise you're going to get runtime errors.

Adam
  • 4,159
  • 4
  • 32
  • 53