Comments (14)
@strangenoora I am happy to read that it solved your issue. I will document it in the readme.
from jace.
The problem is that Jace is using System.Reflection.Emit for its dynamic compiler (to generate and compile dynamically .NET functions) which is what is not possible on Unity. A potential solution could be to use Jace in interpreted mode: it will be slower, but it will not rely on the dynamic compiler.
Would you be able to test this workaround?
from jace.
Thanks for the reply
I'll test it out when I get the chance to.
Also, how much performance hit are we talking about with interpreted vs compiled?
from jace.
See the first page of this github repository. But it heavily depends on how many times you reuse the same function. If you don't reuse compiles functions then there will not be a lot of performance difference
from jace.
@KoalaHao If you only need basic arithmetic you can use Math Expression Evaluator which doesn't user Reflection.Emit but still supports compiled mode
from jace.
I tried interpreted mode, and I am on the 0.8.5 version, i think it has bugs with interpreted version, will upgrade and try again later
from jace.
I am not aware of bugs with the interpreted mode of 0.8.5, but would it be possible to test a more recent version? In case you have issues, let me know and I will look to investigate it.
from jace.
I still havn'nt test the new version yet, but the bug of 0.8.5 is in interpreted mode, all variables gets converted into lower case, then it tries to match with a "not converted to lower case" string, which results in variable not found error
from jace.
version 0.8.5 is 5 years old, so I recommend to upgrade to the newest version. It contains a number of bug fixex.
from jace.
@KoalaHao Did you already had time to try a more recent version of Jace inside a Unity project?
from jace.
Hey there, I have a similar issue. I have a Unity project using the latest version of Unity and a version of Jace I downloaded in August. Performance is not critical for me, I am using Jace because it's nice to let non-programmers to edit game balancing formulas in text. It worked great for me until I switched the scripting backend from Mono (Unity default) to IL2CPP (which is required to make a x64 build for Android, which is required by Google Play Store since August 1st this year).
Here's the error I get
ExecutionEngineException: Attempting to call method 'System.Linq.Expressions.Interpreter.LightLambda::MakeRun1<Jace.FormulaContext,System.Double>' for which no ahead of time (AOT) code was generated. System.Func
2[T,TResult].Invoke (T arg) (at <00000000000000000000000000000000>:0)
System.Linq.Expressions.Expression1[TDelegate].Compile (System.Boolean preferInterpretation) (at <00000000000000000000000000000000>:0) Jace.Execution.DynamicCompiler.BuildFormula (Jace.Operations.Operation operation, Jace.Execution.IFunctionRegistry functionRegistry, Jace.Execution.IConstantRegistry constantRegistry) (at <00000000000000000000000000000000>:0) System.Func
2[T,TResult].Invoke (T arg) (at <00000000000000000000000000000000>:0)`
Googling ExecutionEngineException I found this in the Unity manual
https://docs.unity3d.com/Manual/ScriptingRestrictions.html
Could you help me figure out a workaround like this for my project?
from jace.
After investigating further, I think a workaround won't be possible after all. The manual I linked specifically says namespace System.Reflection.Emit simply isn't supported. I will test Interpreted mode instead.
from jace.
I tried the interpreted mode and it works like a charm.
Sorry for the spam!
Can I suggest adding a note in the readme for Unity projects (using IL2CPP) to consider using the Interpreted mode?
from jace.
@KoalaHao Did you already had time to try a more recent version of Jace inside a Unity project?
Sorry I didn't have time to try the new version. I've fixed the caps problem, force use interpreted mode, and it works
from jace.
Related Issues (20)
- Can we make Random overrideable? HOT 3
- Bitwise operations
- Non base-10 numbers
- Matrix & display function itself
- Override operators HOT 2
- Feature Request: Option to set calc trigonomic functions with degrees (not radian) HOT 1
- Wrong precendence for unitary minus and exponential
- Invalid floating point numbers cause InvalidOperationException
- Problems with ambiguity of e
- Invalid scientific notation leads to IndexOutOfBoundsException instead of ParseException
- Upgrade to NetStandard 2.0 HOT 2
- Interpreter.BuildFormula does not work with constants
- Is this project still being updated? HOT 2
- Runtime Error : Could not load file or assembly System.Runtime HOT 2
- JaceOptions case sensitivity does not get applied to FunctionRegistry or ConstantRegistry on engine constructor HOT 4
- Bug in operators precedence HOT 17
- Request for dynamic variables
- PEMDAS HOT 2
- Introducing _sonic_, a maintained Jace.NET fork/successor HOT 1
- avg function not working HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jace.