Quantcast
Channel: Questions in topic: "assemblies"
Viewing all articles
Browse latest Browse all 145

Proper way to create Unity Assemblies for Shared Projects

$
0
0
I have two Unity projects that need to share some code that uses UnityEngine. I read up about Unity Assemblies, and followed the instructions of how to create one. However, I'm finding that it seems to be quite fragile and will sometimes break for no reason. For example, yesterday I suddenly started getting console warnings about "imported type conflicts" for each of the classes in the assembly, and somehow that meant that the assembly wasn't building even when it said it was.


What I want is to build that assembly (i.e. produce a .dll) into a place where both of the Unity projects can access it. Unfortunately another issue I found was that in order to do a post-build step to tell the assembly to put its .dll in a specific place, there was no way to do this in Visual Studio, so I had to manually put it into the .csproj file at the end. Also, I found that every time I built the project, the .csproj file would reset itself, so I had to go in and manually put in the post-build step every time I wanted to build.


Am I missing something, or am I misusing assemblies? What I did was create a folder with all the scripts I wanted to be shared, then create a Unity assembly at the same level as the folder, meaning all the scripts became part of the assembly. Ultimately it did work but not very well and as above it tended to break, so I've removed it for now and am going to try again.

Viewing all articles
Browse latest Browse all 145

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>