Search Unity

Version Control Package API

Discussion in 'Unity Version Control' started by KjartanK, Nov 23, 2021.

  1. KjartanK

    KjartanK

    Joined:
    Apr 7, 2018
    Posts:
    10
    Hello,

    I've started making myself familiar with the new Version Control package and integration of Plastic into Unity (using 21.2.2f1), but I'm finding that some of my custom Editor tools no longer work as expected, seemingly because some APIs don't return the same responses.

    My main example is the
    Provider.isActive
    check; it would return true when I had Plastic set up the old way (and even now if I change the version control mode to PlasticSCM manually), but returns false now with the version control mode set to visible meta files even though the project is part of an active Plastic repo. I haven't thoroughly tested other
    Provider
    API yet, but haven't had much success in my limited testing.

    Is there a new API that's come with the new integration or is this simply a bug that's still being worked out with the package being in beta?

    Thank you!
     
  2. Ryan-Unity

    Ryan-Unity

    Joined:
    Mar 23, 2016
    Posts:
    1,993
    Hi @KjartanK, I'm sorry to hear that the switch from the Legacy Plastic SCM Integration to the Version Control package has broken your custom Editor tools.

    Currently, there is no public-facing API for the Version Control package for checking whether a Plastic workspace is enabled or not. But I've forward this request along to the team and will post here when there's an update.

    In the meantime, while it's a bit hacky, you could add a check for the existence of the .plastic folder in your project's root folder in order to verify if a Unity Project has a Plastic Workspace. This approach will work regardless of if a project uses the Version Control package to integrate Plastic SCM into Unity or if the project uses the Plastic SCM or Gluon clients separately from Unity.
     
  3. KjartanK

    KjartanK

    Joined:
    Apr 7, 2018
    Posts:
    10
    Thanks for clarifying, Ryan, and for passing along that request to the team. I do want to take a moment to underscore the importance of some of these custom tools to our team's workflows and productivity, so getting access to a public-facing API that roughly matches the Provider API would be a pretty big deal for us.

    I appreciate the note on the workaround to check for the .plastic folder in the project root, because that might cover us for the time being (I'll test it out and see how far I can get). I am concerned that I may not be able to see if the user is actively connected to the version control repo and also do things like check files out or revert them if the Provider API doesn't incidentally work (I'll edit this if my concern ends up being wrong), but hopefully that public API can be prioritized as a feature request.

    Edit: It looks like my concerns were correct. I'm unable to get other Provider APIs working and also AssetDatabase APIs like
    AssetDatabase.IsOpenForEdit
    don't return the correct response either. The AssetDatabase API not returning the correct response (for example, with a Scene that has not been checked out, IsOpenForEdit is returning true when it should be false) feels more like a bug than a feature request, so let me know if you'd like me to submit a bug report.
     
    Last edited: Nov 23, 2021
    Sravzz and Ryan-Unity like this.
  4. KjartanK

    KjartanK

    Joined:
    Apr 7, 2018
    Posts:
    10
    Hey Ryan, I wanted to follow up on this again because we ran into something that's stopped our custom tools in their tracks. It seems like at some point between Unity versions 20.3.21 and 20.3.24 the option to choose "PlasticSCM" as the Version Control Mode was removed, but I can't find anything about that in the release notes.

    Why is this an issue for us? Well, I was able to keep our custom version control workflow tools working by not adding the version control package and continuing to use the old plugin (which allowed continued use of the Provider API with mostly-correct results). With the "PlasticSCM" version control mode gone, our custom tools here won't work until/if there's a public API for the Version Control package.

    For now we've made sure to stay on a minor version of Unity that doesn't remove our workaround for the Provider API, but this obviously isn't a sustainable thing and I'd like to again highlight how big of a difference some of these custom tools made for our team in terms of working with concepts like checking out and locking and avoiding merge conflicts.

    I'd be happy to get on a call with you or someone else from the team if it would be helpful to walk you through what we've developed and why it's helped so much. I would also be happy to hear about any other potential workaround that might get us access to version control status of files via an API of some sort.

    Just trying to up the prioritization of a public API by voicing a user need :)
     
  5. Ryan-Unity

    Ryan-Unity

    Joined:
    Mar 23, 2016
    Posts:
    1,993
    Thank you so much for voicing your concerns. I can see how frustrating that is.

    I think that our Product Manager would like to hear more from you about what you are trying to achieve with your custom tools. It might take a while to schedule a meeting (with holiday breaks coming up for most of the team), but if you could DM me your contact info and preferred availability throughout the week, then I'd be happy to pass it along to them so that they can reach out to you and schedule a convenient time to chat with you.
     
    KjartanK likes this.