Open Ludovic-Regnault opened 1 year ago
Hello Ludovic, exceptional states in Karamba3D are handled by throwing exceptions which transform into an error message in Grasshopper. You could wrap your code in a try-catch block when working in Unity. -- Clemens
Yes, but i did implement try-catch around the AnalyzeTHI method (circled in red i the screenshot) and the unity app would crash despite the try-catch
It is only when i test if "license_is_valid()" before that the code runs without crashing
Thanks for the hint.
The exception comes from the C++ part and cannot be properly handled by C# as it seems.
If someone has in depth experience with SWIG and exception handling any tips on improving the situation would be highly appreciated.
-- Clemens
Describe the bug When the AnalyzeThI.solve Method runs on a model with an invalid license, an error occurs. From unity it evens makes the app crash.
Fix: Could the method throw an exception indicating that the license is not valid, instead of crashing the app? Or/And Describe in the API that the method requires to have a valid license, that can be checked with License.license_is_valid Method
To Reproduce
Notes This is the message generated from Unity:![image](https://user-images.githubusercontent.com/127423086/224073227-fda63eba-50c4-463d-b510-a2758f2c2a6c.png)