Open Badhamknibbs opened 1 month ago
Ah right, prior versions don't have that stuff. Do you have a PR with the changes you did by chance? In the middle of a crunch week at work, so I'll see when I can integrate fixes for them myself if not!
Regarding the last two changes:
UNITY_2021_3_OR_NEWER
.System.Drawing.Imaging
issue seems to be a library bug, where they have a using that isn't even used? It's in Libs > EditorAttributes > Editor > Scripts > Drawers
, but doesn't seem to be used.I was working on the copy downloaded via the package manager so I'll work on a git downloaded version with the changes proper (I found there's a bunch of other misc errors the compiler didn't immediately pick up, e.g. TryAdd() for Dicts isn't a thing along with various other new C# functions)
I've started working on a fork ( https://github.com/Badhamknibbs/unity-project-patcher-2020.3 ), though I'm stuck on some stuff (there's seemingly no equivalent to the relative path function?)
Relative path function? Got an example? And anything else you are stuck on, you can throw into a list and I can help find replacements.
The Path.GetRelativePath function doesn't exist according to Unity 2020.3, and the alternative, PathCoreLib, says it doesn't exist either. I'll get back to you with any other issues when I've got some time on the weekend.
This additional util was for the older versions so maybe the flag is wrong here as well 🤔 But it's meant to be the compatibility layer for situations like this haha https://github.com/nomnomab/unity-project-patcher/blob/master/Editor/Utility/PathNetCore.cs
Ah, didn't realize it was a custom module. I've fixed up more of the compilation errors but there's still some I'm stuck on like I can't access the PathNetCore module from the Libs folder which also use Path.GetRelativePath.
I'm also iffy on how some of the array accessors work since I'm not familiar with them; I'm replacing
var projectRoot = Application.dataPath[..^assetLength];
with
var projectRoot = Application.dataPath.Substring(0, Application.dataPath.Length - assetLength);
Which I'm not sure is correct as the documentation about ..^ is confusing.
Yeah that looks correct. [..^5]
is basically 0
to length - 5
.
Not really sure what you mean by:
I can't access the PathNetCore module from the Libs folder which also use Path.GetRelativePath
PathNetCore is wrapped in the #if !UNITY_2020_3_OR_NEWER
conditional, that's what I was referring to before (with it being possibly incorrect for your version). That file also only uses its own GetRelativePath
, the normal Path
one isn't in there (since that's what it is replacing).
Let me know if I am misunderstanding!
I got GetRelativePath working for the cs files under the Editor folder, however Path.GetRelativePath is also used in cs files under the Libs folder which can't access PathNetCore.
Path.IsPathFullyQualified(filePath) is also used which doesn't exist.
I've gotten everything sorted out, but the EditorAttributes library causes compiler errors on 2020.3 and thus can't be included, so I can't really pull this back into main. Do you know if there'd be any way to exclude the folder for specific Unity versions?
Could try upping the conditional tag on its .asmdef
(since they are both UNITY_2020_3_OR_NEWER
)
and
Trying to add the project patcher to a Unity 2020.3.16f1 project results in multiple compilation errors (183 initially without changes). I tried resolving most them, though some of the issues seem fundamental:
The majority were resolved by doing explicit new, e.g.
if (colorAttribute.UseRGB) return new(colorAttribute.R / 255f, colorAttribute.G / 255f, colorAttribute.B / 255f, alpha);
->if (colorAttribute.UseRGB) return new Color(colorAttribute.R / 255f, colorAttribute.G / 255f, colorAttribute.B / 255f, alpha);
and replacing
is not null
with the classic-style null check, e.g.if (closest.x.original is not null)
->if (closest.x.original != null)
However I couldn't figure out these issues:
UNITY_2020_3_OR_NEWER
, however Unity pools don't exist in 2020.3 (they are a 2021+ feature as far as I can tell).System.Drawing.Imaging
doesn't appear to exist in the C# version used by 2020.3.