Search Unity

Referencing your Unity game script from a plugin

Discussion in 'Scripting' started by ananta-das, Aug 28, 2015.

  1. ananta-das

    ananta-das

    Joined:
    Jan 9, 2015
    Posts:
    25
    Hi,

    I am building a project where I am sharing parts of my game code with another application (think companion app that needs to be aware of the various game classes I have written in Unity). So far, I have been using an architecture where I had the shared code in a plugin assembly that was referencing UnityEngine (thus allowing me to use Unity types) and using it from both places.

    However, this means that each time I want to change something, I have to recompile my plugin and then when I switch back to Unity, it freezes for a while with "Compiling plugins" window - super annoying when you are doing lots of small changes. I know that normal Unity scripts get compiled in the background so this is not a problem.

    So I was wondering, would it be viable to code my common stuff directly in Unity and then just reference the output assembly from my companion app's project? Does anyone have similar experience?

    Thanks
     
  2. GroZZleR

    GroZZleR

    Joined:
    Feb 1, 2015
    Posts:
    3,201
    Are you working on both apps simultaneously? If not, you could just have a local mirror of your scripts working directly with Unity and when you're done working on the main app, push them all out to your DLL and build your plugin, then import that for when you work on your companion app.