Editor2 crashes when you have runtime error in UnigineScript


photo

Recommended Posts

Hi,

I observed that Editor2 crashes when I get runtime error e.g. make some operation at not existing object. I know that I should protect it in the code. But it is possible to just display error in console of Editor 2 instead crash entire Editor 2 ?

Thank You

Link to post
On 5.12.2017 at 4:41 AM, silent said:

Klimczak.Jan,

Could you please attach any particular code example (*.world + .cpp) that can cause Editor 2 crash? 

Thanks!

Here is sample code from Unigine script file (in my case from init function):

    Node node1 = engine.editor.getNode(index);
    node1.getTransform();

Operating at non existing object just crash Editor2 (see second line above) - here I provided not existing index.

I think that better way could be just report such error in console and not load and execute script at all instead of crash editor.

Link to post

Hi,

Do you edit .cpp file in assets/ or in data/ folder?

Thanks!

Link to post
4 hours ago, sebastianbah said:

Hi,

Do you edit .cpp file in assets/ or in data/ folder?

Thanks!

I am editing file in asset folder. The crash happens only when you have already loaded and opened world without in Editor2 ant then edit a script .cpp file from asset folder e.g.:

    Node node1 = engine.editor.getNode(7868);
    node1.getTransform();

In the case you have line as above without existing node with id 7868 and during loading a world at startup you will see just error message in console. 

So the crash only happens if you have already loaded world in engine and then you are try to operate at NULL object.

Link to post
  • 2 weeks later...

Little update for SDK 2.6.1, here in the case of error in script the Editor2 freeze and you should force to close it, and restart it again.

Link to post