Sigma88 / Sigma-Replacements

Handles replacement of various KSP assets
13 stars 1 forks source link

Hidden exceptions as a result of the Unity upgrade #83

Closed linuxgurugamer closed 4 years ago

linuxgurugamer commented 4 years ago

In a debug environment, I get the following errors in the Skybox. From my experience with other mods, this needs to be fixed because it causes crashes a while later. I looked in the code, and in the file NyanSkyBox, at line 16 and line 98 , you are initializing a Texture2D. You need to move it into either an Awake() or into the current Start(). I'm doing a PR for this in a minute or two

I didn't see any errors like this in the other replacements modules. with the possible exception of the EditorView. I was dealing with a number of mods with errors, and I vaguely recall seeing an error in that one, if I find an error while dealing with other mods, I'll post a new issue/pr

UnityException: SupportsTextureFormatNative is not allowed to be called from a MonoBehaviour constructor (or instance field initializer), call it in Awake or Start instead. Called from MonoBehaviour 'NyanSkyBox' on game object 'NyanSkyBox'. See "Script Serialization" page in the Unity Manual for further details. at (wrapper managed-to-native) UnityEngine.SystemInfo.SupportsTextureFormatNative(UnityEngine.TextureFormat) at UnityEngine.SystemInfo.SupportsTextureFormat (UnityEngine.TextureFormat format) [0x0001d] in C:\buildslave\unity\build\Runtime\Export\SystemInfo\SystemInfo.bindings.cs:402 at UnityEngine.Texture.ValidateFormat (UnityEngine.TextureFormat format) [0x00002] in C:\buildslave\unity\build\Runtime\Export\Graphics\Texture.cs:464 at UnityEngine.Texture2D..ctor (System.Int32 width, System.Int32 height, UnityEngine.TextureFormat textureFormat, System.Int32 mipCount, System.Boolean linear, System.IntPtr nativeTex) [0x00009] in C:\buildslave\unity\build\Runtime\Export\Graphics\Texture.cs:527 at UnityEngine.Texture2D..ctor (System.Int32 width, System.Int32 height) [0x00000] in C:\buildslave\unity\build\Runtime\Export\Graphics\Texture.cs:553 at SigmaReplacements.SkyBox.NyanSkyBox..cctor () [0x0001a] in <265113184a074b53abb2e2a6f5dd5180>:0 Rethrow as TypeInitializationException: The type initializer for 'SigmaReplacements.SkyBox.NyanSkyBox' threw an exception.

linuxgurugamer commented 4 years ago

Please note that this is a gamebreaking bug, it causes random crashes a random amount of time after it happens

Sigma88 commented 4 years ago

Ah yes I was told about this bug recently but I didn't have time to go through my mods to see if stuff like this was present.

Thanks for pointing it out !

Sigma88 commented 4 years ago

this should be fixed by #86 so I think it can be closed, I'll let it open just in case you want to do more tests

Sigma88 commented 4 years ago

@linuxgurugamer do you think this line could cause the same issue as the one you described for the nyan texture?

https://github.com/Sigma88/Sigma-Replacements/blob/Development/%5BSource%5D/SigmaReplacements/SkyBox/Version.cs#L11

because, if that's the case, all my mods will need to be fixed šŸ˜±

linuxgurugamer commented 4 years ago

I dont think so. That is a call to a System library. However, why not ask @sarbain for his opinion

On Mon, Dec 16, 2019, 5:19 PM Sigma88 notifications@github.com wrote:

@linuxgurugamer https://github.com/linuxgurugamer do you think this line could cause the same issue as the one you described for the nyan texture?

https://github.com/Sigma88/Sigma-Replacements/blob/Development/%5BSource%5D/SigmaReplacements/SkyBox/Version.cs#L11

because, if that's the case, all my mods will need to be fixed šŸ˜±

ā€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Sigma88/Sigma-Replacements/issues/83?email_source=notifications&email_token=AAMN7VSNU6TCVOZS6KTDYQLQY75FTA5CNFSM4J3KJUPKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHAJYYY#issuecomment-566271075, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMN7VTX5LJTZRS7SRZT3RTQY75FTANCNFSM4J3KJUPA .

Sigma88 commented 4 years ago

I think you mean @sarbian šŸ˜†

linuxgurugamer commented 4 years ago

Hard to type on a phone while my dog is pulling on the leash

linuxgurugamer commented 4 years ago

Ill take a look at it as well. Ill be using the debug environment for tests tonite, and all the sigma mods are installed. If I see an error, I should be able to find the issue, and if I get those files in time, Ill even be able to test the fix.

sarbian commented 4 years ago

I doubt it. System is not a Unity object so it should be perfectly fine there

Sigma88 commented 4 years ago

thanks for the help sarbian

so, I can assume this was not necessary?

https://github.com/Sigma88/Sigma-Replacements/commit/dbd0d15a4b99a5d3907de7188ac983e0d9f6d899