Warning before launching

If there is something important you think is missing in the current version of ZGameEditor then you can post a feature request here!

Moderator: Moderators

Post Reply
User avatar
rrTea
Posts: 475
Joined: Sat Feb 15, 2014 9:54 am

Warning before launching

Post by rrTea »

Certain components can crash a ZGE project immediately if left in their default state. For example the "RenderMesh" component, if left empty (no mesh is selected), crashes everything as soon as invoked etc. I think RenderMaterial also does that.

I can't think of an everyday use of leaving these empty - there probably is a case, but chances are that leaving this kind of components on "empty" is a mistake. In my opinion it'd be helpful if a warning popped up (in the console maybe) if I try to execute a project that contains components in such a state.

For example yesterday at one point I fumbled and misclicked something around a RenderMesh component (setting it to empty by mistake) which started crashing the whole thing... I was convinced it's crashing because I'm doing something wrong with an array (completely unrelated) and kept poking there for a while before realizing what's going on.
User avatar
Kjell
Posts: 1910
Joined: Sat Feb 23, 2008 11:15 pm

Re: Warning before launching

Post by Kjell »

Hi rrTea,
rrTea wrote:Certain components can crash a ZGE project immediately if left in their default state. For example the "RenderMesh" component, if left empty (no mesh is selected), crashes everything as soon as invoked etc.
Correct, FileAction is the only other one that comes to mind ...
rrTea wrote:I think RenderMaterial also does that.
In case you're referring to the UseMaterial component, that actually resets the active material to the default when set to NULL.
rrTea wrote:I can't think of an everyday use of leaving these empty - there probably is a case, but chances are that leaving this kind of components on "empty" is a mistake.
Well, you could for instance have a situation were you ( randomly ) set a the Mesh property of RenderMesh from code when it is NULL, in which case you probably want the initial value to be NULL.
rrTea wrote:In my opinion it'd be helpful if a warning popped up (in the console maybe) if I try to execute a project that contains components in such a state.
I personally think it would be better that when you have a Mesh / FileAction component set to NULL that the component is simply skipped / not executed. But in case someone / Ville thinks that additional if-statement in the source is ugly / slow, i'd suggest making the error messages a little more informative ( currently it only states something like "Runtime error 216 at 0040ABCD ), so you have a better idea what's causing the crash.

K
User avatar
rrTea
Posts: 475
Joined: Sat Feb 15, 2014 9:54 am

Re: Warning before launching

Post by rrTea »

Hi Kjell,
In case you're referring to the UseMaterial component, that actually resets the active material to the default when set to NULL.
Right it wasn't UseMaterial, it's PlaySound which too can be left at NULL for certain situations but in "everyday" use (see below)… if left like that it will just crash. StartAnimator crashes if left empty too. RefreshContent is another one. Maybe there are others.

Curiously, an empty CallComponent doesn't crash (I'd expect that to crash immediately).
Well, you could for instance have a situation were you ( randomly ) set a the Mesh property of RenderMesh from code when it is NULL, in which case you probably want the initial value to be NULL.
Correct, that's why I said "everyday use" because from everything I saw (both my projects and all the projects I collected from various sources like forum tutorials, chat channel etc) the component is usually set to something and keeping it empty is an exception, one that I never saw used but can imagine being useful in theory.
I personally think it would be better that when you have a Mesh / FileAction component set to NULL that the component is simply skipped / not executed. But in case someone / Ville thinks that additional if-statement in the source is ugly / slow, i'd suggest making the error messages a little more informative ( currently it only states something like "Runtime error 216 at 0040ABCD ), so you have a better idea what's causing the crash.
I'm fine with anything that's better than just "randomly" crashing with a mysterious Windows-style message.
Post Reply