unity-jar-resolver icon indicating copy to clipboard operation
unity-jar-resolver copied to clipboard

GvhProjectSettings.xml stored in ProjectSettings folder

Open leosunity opened this issue 5 years ago • 7 comments

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.

leosunity avatar Mar 31 '20 01:03 leosunity

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.

chkuang-g avatar Apr 02 '20 05:04 chkuang-g

Will do. Thanks.

leosunity avatar Apr 02 '20 15:04 leosunity

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.

tarrowood-imangi avatar Apr 06 '20 18:04 tarrowood-imangi

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?

SimonAExient avatar Apr 15 '20 16:04 SimonAExient

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.

patm1987 avatar Apr 17 '20 16:04 patm1987

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?

NotTheEconomist avatar Oct 08 '20 07:10 NotTheEconomist

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.

ChrisMasterton avatar Mar 18 '22 22:03 ChrisMasterton