googlesamples / unity-jar-resolver

Unity plugin which resolves Android & iOS dependencies and performs version management
Other
1.27k stars 344 forks source link

GvhProjectSettings.xml stored in ProjectSettings folder #345

Open leosunity opened 4 years ago

leosunity commented 4 years ago

Hello!

This is related to this issue.

It is recommended for project configuration files to be stored in the Assets folder for Unity projects. The Provider.Checkout API may have happened to work with files outside of Assets in the past, but other functionality (Unity Collaborate) does not. We are trying to update our documentation.

Could the GvhProjectSettings.xml file be moved to the Assets folder? Unity would then recognize the file, which could be used by other systems.

chkuang-g commented 4 years ago

AFAIK, the path to GvhProjectSettings.xml is hard-coded here. https://github.com/googlesamples/unity-jar-resolver/blob/master/source/VersionHandlerImpl/src/ProjectSettings.cs#L359

We currently do not have plan to support this but feel free to add the option to save it in Assets folder and send us a pull request.

leosunity commented 4 years ago

Will do. Thanks.

tarrowood-imangi commented 4 years ago

Weighing in on this as I was the one who reported the issue to Unity: this isn't a feature request, this is a breaking bug for Perforce users in Unity 2019. The Checkout API no longer works on files in ProjectSettings, and rather than checking writability or making the file writable, setting file save just bails with an error like: "Unable to checkout 'ProjectSettings/GvhProjectSettings.xml'. Project settings were not saved!" This means GvhProjectSettings.xml and AndroidResolverDependencies.xml never get saved, even if the file is manually checked out and already writable.

SimonAExient commented 4 years ago

I'm also using Perforce and Unity 2019 (2019.3.9f1) and have been looking at this due to issue #275

An observation is that although this fails:

  Task t = UnityEditor.VersionControl.Provider.Checkout("ProjectSettings/GvhProjectSettings.xml", UnityEditor.VersionControl.CheckoutMode.Exact);
  t.Wait();

This seems to work ok:

  AssetList assets = new AssetList();
  assets.Add(new Asset("ProjectSettings/GvhProjectSettings.xml"));
  Task t = UnityEditor.VersionControl.Provider.Checkout(assets, UnityEditor.VersionControl.CheckoutMode.Exact);
  t.Wait();

Whether this is useful, I'm unsure - perhaps as an alternative workaround?

patm1987 commented 4 years ago

I'll leave this open as a feature request to move GvhProjectSettings.xml, but does the fix for #359 work as a workaround for people experiencing issues here?

Version 1.2.151 of the unity jar resolver has some logic to avoid an exception related to perforce that @simon532 reported.

NotTheEconomist commented 4 years ago

Weighing in on this as I was the one who reported the issue to Unity: this isn't a feature request, this is a breaking bug for Perforce users in Unity 2019. The Checkout API no longer works on files in ProjectSettings, and rather than checking writability or making the file writable, setting file save just bails with an error like: "Unable to checkout 'ProjectSettings/GvhProjectSettings.xml'. Project settings were not saved!" This means GvhProjectSettings.xml and AndroidResolverDependencies.xml never get saved, even if the file is manually checked out and already writable.

We're still experiencing this issue on 1.2.153. @tarrowood could you share the issue link on Unity's side?

ChrisMasterton commented 2 years ago

A workaround for Perforce & Unity (& cloud build in particular) was to modify the perforce workspace with the "allwrite" flag. This leaves client files as writable after getting latest. Creating a new workspace with this "allwrite" flag was the only thing that worked for me (after trying all of the above).

Unity has also started writing .xml files to the ProjectSettings folder (see Unity Mediation beta) so not sure if I hold out much hope for a fix on the Unity side.