Declaring an enum in a mod crashes the game?

Discuss modding questions and implementation details.
Post Reply
DFIronman
Posts: 60
Joined: Sat Aug 24, 2019 12:48 am

Declaring an enum in a mod crashes the game?

Post by DFIronman » Fri Aug 30, 2019 7:08 am

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.

User avatar
Ferital
Posts: 176
Joined: Thu Apr 05, 2018 8:01 am

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

Post by Ferital » Fri Aug 30, 2019 7:42 am

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

User avatar
Jay_H
Posts: 2899
Joined: Tue Aug 25, 2015 1:54 am

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

Post by Jay_H » Fri Aug 30, 2019 4:34 pm

Moving :)

DFIronman
Posts: 60
Joined: Sat Aug 24, 2019 12:48 am

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

Post by DFIronman » Mon Sep 02, 2019 1:31 am

Ah ok, thanks.

Post Reply