here's the error that I can't seem to get rid of.

FATAL ERROR in action number 1 of Step Event0 for object side2_obj3:

Variable side2_obj3.sidePick2(100004, -2147483648) not set before reading it. at gml_Object_side2_obj3_StepNormalEvent_1 (line 1) - if (sidePick2 == 1)

this object is inheriting from an object that holds the variables sidePick1 and sidePick2. I stripped the level down to just the object to see if this was being caused by a code collision and the issue seems to be persisting.


I gave tried calling the following function

Event_inherited ()

And it didn't work

  • \$\begingroup\$ Avoid marking an answer as accepted if it doesn't work :P \$\endgroup\$ – Vaillancourt May 18 '17 at 16:56
  • \$\begingroup\$ Sorry, thought it was the approved button. Still kind of new here. \$\endgroup\$ – Carson May 18 '17 at 17:01
  • \$\begingroup\$ Sure, no problem :) \$\endgroup\$ – Vaillancourt May 18 '17 at 17:02
  • \$\begingroup\$ Share your project \$\endgroup\$ – Dmi7ry May 19 '17 at 6:26

Make sure you called


In the create event of child object (side2), because if you put something else in the event (create event in this case), the inheritance won't work without manual call of the function.

  • \$\begingroup\$ I have in fact tried that. I know GML has assumed inheritance unless otherwise stated but I know how C++ can be whiny about this exact kind of issue so I looked into explicit inheritance in GML. \$\endgroup\$ – Carson May 18 '17 at 15:00

I figured it out. in GML, event_inherited only works on step 0 and forward, relative to the object. if the creation code for an object executes on the same step as the creation code for a child, the child will not have time to inherit. Normally this wouldn't matter, but if the creation code for the child alters the local version of a variable provided by the parent, the object might not have the time to acquire and set the inherited variable before attempting to access it.

Kirk Summation : imagine 2 cars, identical except one doesnt have an ignition. its okay because you have left instructions on which ignition to use and how to install it. but the instructions say to drop the part in at the second the race starts. obviously, the car wont go because the ignition isnt installed until the second the race starts. same basic concept.

  • \$\begingroup\$ you should call event_inherited() in create event, before any other actions. \$\endgroup\$ – Dmi7ry May 20 '17 at 7:19
  • \$\begingroup\$ I tried that. The issue is that on step zero of an object's timeline the variables are still being set, so children have nothing to inherit. For that reason you can't run creation inheritance that executes on the same step as the parent's creation because there is nothing to inherit until after that step \$\endgroup\$ – Carson May 20 '17 at 18:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.