Jump to content

Move detection with Plastic Plugin for Unity


Garrett
 Share

Recommended Posts

Hello,

while using the Plastic plugin for Unity you (or some script) remove any file and it is marked as deleted, then you add this file again (slightly modified) and it is marked as added. Now you have deleted and added files in pending changes. The "Search matches" option is grayed out (not available) in this case. 

If you do the same operation but with the Plastic plugin closed (or turned off for older unity versions) then the Plastic client will detect such operation as a move (which is the desired behavior in most cases).

This is important because deleting and importing packages is exactly how you usually update third-party plugins in Unity. Is there a proper way to perform such an operation without disabling the Plastic plugin?

Another problem is: if you delete some folder, import an updated package with some of the files changed, and then decide to undo such operation by clicking "Undo changes" - you will receive a whole bunch of files with *.private.0 and *.private.0.meta endings. 

Link to comment
Share on other sites

Any update on this one? I'm currently evaluating a switch from github due to repo size issues. These operations work fine in git but fail miserably in plastic.

Folder moves and inplace file updates like Garrett mentioned are not handled correctly on another machine that pulls down the update. The machine that is updating their workspace will make a delete and copied (new) for every file that was deleted and moved, or updated by a package update. Almost seems like an order of operations issue, or perhaps Unity is trying to import the file changes while the workspace update is still happening in the background.

Link to comment
Share on other sites

8 hours ago, cloudwalker said:

These operations work fine in git but fail miserably in plastic.

I don't completely get all the details of your problem, but in any case (actually usually there is two cases, when files considered added and deleted, or they considered moved but match the wrong files). 

For case where you have a lot of deleted/added pairs - just turn off Unity Plugin.

If you have wrong moves in case you decided to reorder your folder structure after synchronizing with git - you can on the opposite manually go to Workspace Explorer (plastic client) and move folders there, thus Plastic will correctly understand moves, unlike if you moved them from the File Explorer.

  • Like 1
Link to comment
Share on other sites

I tested two things that I wanted to be sure that worked in plastic like they do in git.

1. Updating a store asset package

2. Moving a folder or other files around (re-organizing)

After checking in the changes post update or move, I test an Update on a 2nd machine to see how it behaves. After the update is finished, there are an equal amount of deletes / adds for every file that was updated where there should be absolutely zero. It could be due to the post checkin adds / removes screwing up the Update on the 2nd machine - not sure. Not experienced with plastic scm yet.

Like you said disabling the Unity Plugin before updatingmight fix the issue? When I use git to pull down the updates that have many file updates or folder moves it always completes cleanly even if Unity is open at the time.

Link to comment
Share on other sites

2 hours ago, cloudwalker said:

Like you said disabling the Unity Plugin before updatingmight fix the issue? When I use git to pull down the updates that have many file updates or folder moves it always completes cleanly even if Unity is open at the time.

First I must do a disclaimer, I do not claim this is the correct behavior (that is why I posted this topic in the first place). Now let's get down to "Unity is open at the time". It is not unity who have to do anything with the files, but exactly the plugin, who marks them as deleted as soon as you click delete on something. (and that is the correct behavior). The problem is what is NOT happening when you added package back, for some reason plugin do not even try to match those files with the deleted ones. And this issue exists for at least 7 years now, that is why I decided to work with Plastic Client without any plugins.

And this post... this post was born when I saw that Unity changed how we turn off and on the plugin in newer Unity versions. Previously we intentionally set Version Control Mode to "Plastic" if we wish to use it, and keep it "Visible Metafiles" otherwise. Now we open editor window and plugin is enabled, we close it and it is disabled. But I fear of the day Unity will make it work always as soon as you have .plastic folder in the root of project directory and this day could be a disaster for me, unless Unity or Plastic fix this annoying issue with the plugin. 

So please, @Sravya, at least make sure in some point in time you guys do not force to use Plastic Plugin if project folder is under plastic version control.

Link to comment
Share on other sites

On 2/2/2022 at 8:46 PM, Sravz said:

Hello, I have opened a ticket for this issue, our dev team will look into it and triage.

Hello again, could you please shed some light on this issue? Today I've updated version control package to the Version 1.15.12 and now there is no way to disable the plugin at all. The only way to work with Plastic in Unity is to completely remove Version Control package from the package manager, otherwise you are stuck with the issue I've described at the beginning of this topic.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...