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.
Warning before launching
Moderator: Moderators
Re: Warning before launching
Hi rrTea,
K
Correct, FileAction is the only other one that comes to mind ...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.
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 think RenderMaterial also does that.
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: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.
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.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.
K
Re: Warning before launching
Hi Kjell,
Curiously, an empty CallComponent doesn't crash (I'd expect that to crash immediately).
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.In case you're referring to the UseMaterial component, that actually resets the active material to the default when set to NULL.
Curiously, an empty CallComponent doesn't crash (I'd expect that to crash immediately).
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.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.
I'm fine with anything that's better than just "randomly" crashing with a mysterious Windows-style message.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.