I saved a .compute file from one project to another, but in the second project Unity isn’t recognizing it as a Compute Shader. Its icon is just a text-file icon, and I can’t drag it into a Compute Shader field in the inspector. However, if I right-click Create a new Compute Shader in the project, that one gets the icon and works correctly.
May be you didn’t copy .meta file alongside with shader? It seems there’s no other places where Unity contains information about files, so if file extension is correct - the problem might be with meta file.
Meta is also stored within the “Library/metadata” directory which you can find in the root of your project folder. Although this may be a source of corruption it wouldn’t be wise to tinker around in there as those files are internally managed by Unity.
Instead, just copy the contents of your old compute shader into your newly created compute shader and leave Unity to re-create the associated meta files automagically.
It seems really weird a source-code file would need metadata to tell Unity it’s a source-code file. You don’t need that for .cs files or anything. It should know based on the file extension, .compute.