So. I like to code. I like to play Paradox Interactive games. One thing that I always wondered about was how exactly their implementation of their trigger evaluation/event evaluation system looked like. So I decided I would write myself an implementation and find out!
Now, I didn't want to manually parse their text files out. I could, but it would be an insane waste of time since other people have already developed efficient libraries for it. So I downloaded and set up this nice little library that handles the nasty little details.
I tested the parser to make sure it works. Worked like a charm. Then I started coding. A full day of planning, trial, and error later, I had a very early version ready.
Then I created a C# script with a basic implementation of my new library. I created a basic spherical mesh and dragged it onto my scene. I dragged said C# MonoBehaviour onto my object. I created a country class implementing my 'IScope' interface. I set the "scope chain" up.
I created a text file with the following contents:
trigger = {
id = 5
vassal = {
id = 6
}
}
It worked in the parser before. I then wrote the following code in my Start method:
void Start()
{
ScriptBinding.Instance.ReserveTrigger("id", new CheckIDTrigger());
ScriptBinding.Instance.ReserveScopeName("vassal");
string path = Application.dataPath + "/ParadoxScriptingEngine/Tests/test_trigger.txt";
Debug.Log(path);
FileStream stream = File.OpenRead(path);
c = new Country(5); //Declared as a class member. Implements IScope.
tb = new TriggerBlock();
ParadoxParser.Parse(test_script, tb);
scope_chain = new IScope[10];
scope_chain[0] = c; //ROOT
scope_chain[1] = c; //THIS
}
And in Update:
void Update()
{
Debug.Log("The trigger has evaluated to " + tb.Eval(scope_chain));
}
When I deactivate the script that launches the parser, the project runs. When I reactivate it and try to run it, the editor instantly crashes.
I have riddled my project with debug statements, but this is just starting to get ridiculous. I have traced through the entire program in my mind, but it is 17 files long all told, and without any data on the error I cannot possibly hope to debug it. The log files are empty as well.
Is there a way to get Unity to print ALL information on errors?
I know that the problem has to be related to my program, so perhaps the better question would be; what kind of problem will cause Unity to not print the error out? I know infinite loops will do it, but there is no way it is an infinite loop is causing this problem - I only used for each loops.