Search Unity

Best way to structure project where code is also used outside Unity

Discussion in 'Formats & External Tools' started by nrkn, Apr 23, 2019.

  1. nrkn

    nrkn

    Joined:
    Jan 31, 2016
    Posts:
    2
    We're making a very simple turn based RPG

    We have the game simulation implemented as a .NET class library

    The simulation defers IO and rendering to Unity, but we also implemented the IO and rendering layer as mocks for unit testing, and we also have a console application that implements IO and rendering using ascii roguelike style graphics

    In our previous project where we needed to reuse code outside of unity, we had separate solutions and had a build step that deployed the class library DLL to our Unity project folder

    However it's much easier to work with code in Unity than it is to work with a DLL - how would we best structure our projects so they can share the same simulation, but also have the advantages of the simulation code living "inside" Unity?
     
  2. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,334
    I haven't tried it, but you could have your shared code as a git submodule. That should, in theory, allow you to share both code and changes between the console application and the Unity game.
     
    nrkn likes this.
  3. nrkn

    nrkn

    Joined:
    Jan 31, 2016
    Posts:
    2
    OK, that looks like it might work, will look into it. Thanks!