-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] Dissonance is not compatible with Unity Packages #196
Comments
Have you checked that the uses of the The Unity asset store team keep promising that the Unity Asset Store will support packages as a way to distribute assets. Once that's available we will definitely be moving over as soon as possible! |
Hi Martin, |
Thanks for this! I'll see if I can include it in the next release. |
The most likely problem seems like something to do with assemblies (e.g. Mirror integration can't find some code it needs which is hidden away in the Dissonance assembly). I'm not sure precisely how asmdefs interact with packages. However I can't see how anything like that could lead to a situation where compile errors don't work properly! |
Thanks for the hint Martin !
And that's it! No more problems. Everything seems fine now! |
@cliv3dev Did you change anything at the Startup.cs or DissonanceRoothPath.cs or did you fix it just by adding assembly definitions? |
I had to do both: change the startup.cs + tweak assembly definition files to do the trick... |
Ouh, that was a quick reply. Thanks, i'll give it a try |
For me, the modifications to Startup.cs didn't work, so I added some code to search for the file in all asset paths and then I could find and set the install directory path successfully. We can probably replace the // search everywhere for DissonanceComms.cs
string foundPath = null;
var installDirectoryProjPath="";
var allAssetPaths = AssetDatabase.GetAllAssetPaths();
var fileName = "DissonanceComms.cs";
for(int i = 0; i < allAssetPaths.Length; ++i)
{
if (allAssetPaths[i].EndsWith(fileName))
{
foundPath = allAssetPaths[i].Replace(Path.DirectorySeparatorChar.ToString(), "/").Replace("/DissonanceComms.cs", "");
}
}
if (foundPath != null) {
installDirectoryProjPath = foundPath;
}
else {
//Find the DissonanceComms.cs file
var maybePathFile = Directory
.GetFiles(Application.dataPath, "DissonanceComms.cs", SearchOption.AllDirectories)
.SingleOrDefault();
if (maybePathFile == null)
{
Debug.LogError(
"Cannot Find DissonanceComms.cs! Dissonance has not been installed correctly. Please delete all Dissonance related files and import them again");
return false;
}
//Convert into a full path with normalized file separators
var fileFullPath =
new FileInfo(Path.GetFullPath(maybePathFile)).FullName.Replace(
Path.DirectorySeparatorChar.ToString(), "/");
if (!fileFullPath.StartsWith(Application.dataPath.Replace(Path.DirectorySeparatorChar.ToString(), "/")))
throw new InvalidOperationException(
"Dissonance install directory is not a child directory of 'Application.dataPath'!");
//Work out the path to the install directory (as a project path)
installDirectoryProjPath = Application.dataPath.Split('/').Last() + "/" + fileFullPath
.Substring(Application.dataPath.Length).TrimStart('/').Replace("/DissonanceComms.cs", "");
//If the path is correct we're good to go
if (installDirectoryProjPath == DissonanceRootPath.BasePath)
return true;
} |
Context
In my project I split my code between several Unity packages
![image](https://user-images.githubusercontent.com/22072701/83266970-db68e200-a1c3-11ea-8c5b-d7dc1639c5f9.png)
Dissonance SDK is in one of those packages.
Expected Behavior
Dissonance should work as intended when embedded in a package.
Actual Behavior
When I open a project using those packages, I get this error:
![image](https://user-images.githubusercontent.com/22072701/83267047-f89db080-a1c3-11ea-847f-0505250377e9.png)
![image](https://user-images.githubusercontent.com/22072701/83267989-449d2500-a1c5-11ea-99ce-6c92b9ca56a0.png)
Workaround
We updated DissonanceRoothPath.cs with this fix:
![image](https://user-images.githubusercontent.com/22072701/83267208-2aaf1280-a1c4-11ea-8dc2-af77010ca379.png)
Steps to Reproduce
Your Environment
Dissonance version used: v6.4.6 (2020-03-11)
Unity version: 2019.3.11f1
Editor Operating System and version: Windows 10 Pro
Thanks!
The text was updated successfully, but these errors were encountered: