I have a question regarding the Unity compilation order. I’ve read all of the information at Unity - Scripting API: about script compilation, and understand that. My problem is that I am using a dialogue engine written in js, where the rest of my game is written in C#.
All of the js code is contained in Standard Assets, so it will be compiled first. Then all of the C# code is contained in the Resources folder, so it is compiled after the js. In this way the C# can reference the js, but not the other way around.
My problem is that I need the dialogue engine, written in js, to be able to check game state variables that are in the C# part of the code. I was hoping to do this through the use of the eval() function, which allows you to execute code input in the form of a string. My thinking was that the eval call does not occur until run time, and so by that point both the js and C# should be compiled and so code in the eval should be able to reference either one.
I have verified that the eval is not called until runtime, however I still receive an error:
CompilationErrorsException: script(1,1): BCE0005: Boo.Lang.Compiler.CompilerError: Unknown identifier: ‘DramaDebugger’
The code being executed in the eval statement is:
DramaDebugger is a C# singleton class I have defined. Does anyone have any suggestions or ideas as to why this is still throwing a compiler error? Because I know that DramaDebugger has already been compiled by the time the eval call occurs.
Sorry for the long post, and let me know if anything is unclear or you need more information. Thanks!