Not a Bug

Generate Inspectors fails if the "Generated" folder is not checked out (Perforce Integration)

Andy Buchanan 4 years ago updated by John Austin 3 years ago 10

Not a show stopper since you can just check it out and re-run, but might be cool if it used the Version Control API to automate the step.

Bolt Version:
Unity Version:
Scripting Backend:
.NET Version (API Compatibility Level):

Hm, can you be more specific as to what fails? I don't use Perforce so I can't test myself.

If you want to run that step from script, you can use (undocumented / might change later):


UnauthorizedAccessException: Access to the path "D:/Wish/Perforce/KIP/Main/Scratch/ArtTest/FirstPass_AnimationTests/SwirlyThing.2017/Assets\Generated/Ludiq.Core\Property Providers\Editor.meta" is denied.
System.IO.File.Delete (System.String path) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/File.cs:179)
Ludiq.SerializedPropertyProviderProvider.GenerateProviderScripts () (at C:/Users/Lazlo/Projects/Ludiq/Ludiq.Core/Editor/SerializedProperties/SerializedPropertyProviderProvider.cs:40)
Ludiq.GeneratePropertyProvidersPage.OnContentGUI () (at C:/Users/Lazlo/Projects/Ludiq/Ludiq.Core/Editor/Windows/GeneratePropertyProvidersWindow/GeneratePropertyProvidersPage.cs:38)
Ludiq.GeneratePropertyProvidersPage:OnContentGUI() (at C:/Users/Lazlo/Projects/Ludiq/Ludiq.Core/Editor/Windows/GeneratePropertyProvidersWindow/GeneratePropertyProvidersPage.cs:45)
Ludiq.Page:DrawContent() (at C:/Users/Lazlo/Projects/Ludiq/Ludiq.Core/Editor/Windows/Page.cs:56)
Ludiq.Wizard:OnGUI() (at C:/Users/Lazlo/Projects/Ludiq/Ludiq.Core/Editor/Windows/Wizard.cs:103)
Ludiq.WrappedEditorWindow:OnGUI() (at C:/Users/Lazlo/Projects/Ludiq/Ludiq.Core/Editor/Windows/WrappedEditorWindow.cs:41)

If you feel like testing perforce integration I think you can still get a free 2 seat licence.

I'm a bit confused as to what's happening here. The folder exists, but Perforce seems to have a mutex lock on it. 

When you're "not checked out", in which "state" are you? Haven't used Perforce but if it's any similar to Git, the folder shouldn't even exist if you're not checked out, right?

Perforce works on a locking model, all files that Perforce is managing will be marked as read-only, a file only becomes writable if it is checked out. You can make sure files are checked out in Unity using the Version Control API.  e.g. (From one of my plugins) 

UnityEditor.VersionControl.Provider.Checkout( eventsFile, UnityEditor.VersionControl.CheckoutMode.
Both ).Wait();

Unity tends to handle this for you automatically when you're using Assets, but other file ops have to be done manually like this


I don't feel comfortable enough with Unity's version control integration to start lacing every file generation code in Bolt with automated checkouts. For now, this will remain unresolved; as you mentioned, you can just checkout before generating.

Perhaps you could check the read-only attribute an give a more useful error message.

I'd like to resurface this issue -- it's pretty awkward for our team, and we'd really like to use Bolt. :(

Unity definitely intends that you add Source Control hooks for file system actions. It's the only way to work with Perforce, and basically every studio greater than 10 people uses Perforce, regardless of whether we would like to. :P

It's a pretty easy fix, too!