TextureReplacer icon indicating copy to clipboard operation
TextureReplacer copied to clipboard

Compilation issues

Open unquietwiki opened this issue 3 years ago • 9 comments

Hey there. I wanted to play around with the source code, and noticed that I couldn't invoke Array.Fill with the current libraries (had to revert to foreach); and that the Reload function for the Mapping class appears to not be constructed correctly. Please advise. Thanks!

unquietwiki avatar Jan 18 '22 10:01 unquietwiki

No, it compiles just fine with KSP 1.12.x. Check that all dependencies point correctly to assemblies in your KSP directory.

And what Reload() function are you talking about? There is no such function in the source.

ducakar avatar Jan 19 '22 17:01 ducakar

Hey @ducakar sorry for the confusion. I meant the Recreate constructor: it expects a TextureMap, but doesn't get one. I'm also using the correct references, and even tried adding ones that are in the MechJeb project (started messing around with that code too & submitted some stuff). As for Array.Fill, Framework 4.8 it got stuff from the .NET Core 2.x work, but I don't think it got the functions from it.

https://github.com/ducakar/TextureReplacer/blob/master/TextureReplacer/Mapper.cs

https://docs.microsoft.com/en-us/dotnet/api/system.array.fill?view=net-6.0

unquietwiki avatar Jan 19 '22 22:01 unquietwiki

Hey @ducakar I had a chance to revisit this. I applied some research I did trying to figure out how other addons work, and came up with some changes you may want to test out. Regarding my original concerns, I did find the Array.Fill implementation the .NET folks use, and I tried converting the KeyValuePair calls to Dictionary calls; apparently both of those are a part of .NET Standard 2.1 & later; wherein Unity 2019 supports .NET Framework 4.x and Standard 2.0.

https://github.com/unquietwiki/TextureReplacer

unquietwiki avatar Feb 05 '22 11:02 unquietwiki

Unity doesn't use .NET Framework but Mono and Array.Fill() works with Mono targeting .NET Framework 4.8 profile.

ducakar avatar Feb 07 '22 02:02 ducakar

@ducakar are you using Unity, MonoDevelop, VS Studio, or ReSharper to do your work? I can report VS 2022 with .NET 4.8 target doesn't work for the functions after .NET Standard 2.0 or Core 2.0 (there are a bunch of Nugets that have backported functions).

unquietwiki avatar Feb 07 '22 02:02 unquietwiki

Arch Linux + Mono 6.13 + Rider 2021.3 (or VS Code + C# plugin). I currently don't have Unity installed, I only need it to build the shaders.

ducakar avatar Feb 07 '22 02:02 ducakar

Ah okay. The discussions I've been having with other modders the past few weeks as I wade into this territory, show some disagreement about framework targeting & lamenting over Unity's modifications to Mono (which reports as some weird .NET 4.6 variant). If I understand what you're doing properly, then as far as they've told me, it shouldn't work. And yet it does?

Anyhow; since you have a different compiler setup than I do, if you need me to do something different on my end for changes for you to review, I can do that. Maybe a fork without the Vessel & KeyArrayValue changes, that you're able to compile? On 2/6/2022 6:39:45 PM, Davorin Učakar @.> wrote: Arch Linux + Mono 6.13 + Rider 2021.3. I currently don't have Unity installed, I only need it to build the shaders. — Reply to this email directly, view it on GitHub [https://github.com/ducakar/TextureReplacer/issues/22#issuecomment-1031016599], or unsubscribe [https://github.com/notifications/unsubscribe-auth/AAHV7PZK3BYJJFGSSPEGSRDUZ4WHDANCNFSM5MGY3NEQ]. Triage notifications on the go with GitHub Mobile for iOS [https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675] or Android [https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub]. You are receiving this because you authored the thread.Message ID: @.>

unquietwiki avatar Feb 07 '22 02:02 unquietwiki

I can replace the two Array.Fill() calls with foreach loops if that's all that's required to build in on Windows.

ducakar avatar Feb 07 '22 03:02 ducakar

Cool beans!

Michael Adams, unquietwiki.com

On Sun, Feb 6, 2022, 7:50 PM Davorin Učakar @.***> wrote:

I can replace the two Array.Fill() calls with foreach loops if that's all that's required to build in on Windows.

— Reply to this email directly, view it on GitHub https://github.com/ducakar/TextureReplacer/issues/22#issuecomment-1031044481, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHV7P7XBSAIUY5XGQB2W6DUZ46P5ANCNFSM5MGY3NEQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>

unquietwiki avatar Feb 07 '22 05:02 unquietwiki