Page 1 of 1

Declaring an enum in a mod crashes the game?

Posted: Fri Aug 30, 2019 7:08 am
by DFIronman
So this is really weird. I don't know if you can do anything about it, but putting the following code in my mod will crash the live game (crashes DaggerfallUnity.exe, but works in the Unity Editor):

This crashes when running DaggerfallUnity.exe and clicking "Play"

Code: Select all

        public enum IronmanSetting
        {
        	DISABLE_PAUSING,
        	DISABLE_EXITING,
        	MODIFY_SHOP_BURGLARY,
        	MODIFY_LOAN_SYSTEM
	}
This does not crash when running DaggerfallUnity.exe and clicking "Play"

Code: Select all

        public static class IronmanSetting
        {
            public const int DISABLE_PAUSING = 0;
            public const int DISABLE_EXITING = 1;
            public const int MODIFY_SHOP_BURGLARY = 2;
            public const int MODIFY_LOAN_SYSTEM = 3;
        }
I added that enum and a bunch of other changes before re-packaging the mod. In order to track down that crash, I had to delete all of my code and paste it back in snippet-by-snippet. The output log wasn't very helpful because it just shows an error at the mod compiler.

Is there a good way to track down a crash that a mod causes? This is the second time I've had to do so and it can be pretty time-consuming without any solid debug info to go with.

Also, is there a decent way to track down what invalidates a mod at runtime? I had an issue with a typo when trying to load one of my mod's settings and there was nothing useful in the log.

Re: Declaring an enum in a mod crashes the game?

Posted: Fri Aug 30, 2019 7:42 am
by Ferital
This is a known issue: viewtopic.php?f=22&t=277#p3798. The only solution there is to keep using constants instead.

By the way, discussions related to modding should be opened in the dedicated subforum: viewforum.php?f=22

Re: Declaring an enum in a mod crashes the game?

Posted: Fri Aug 30, 2019 4:34 pm
by Jay_H
Moving :)

Re: Declaring an enum in a mod crashes the game?

Posted: Mon Sep 02, 2019 1:31 am
by DFIronman
Ah ok, thanks.