• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Cannot create instance childen object with new variable value

Hi,

I'm a beginner.
I have a parent object with some variables like that:
1631817775093.png

I change the value of Type variable (override in child object):
1631817905769.png

My Code:
GML:
with(instance_create_layer(x,y,"Instances", oGiftChild)){
        
}
I try to create instance of childen, I get error:
Code:
Variable oGiftChild.P(100035, -2147483648) not set before reading it.
 at gml_Object_oGiftChild_PreCreate_0 (line 2) - type=P;
If I use the default option, not override variables, It works. I don't understand.
Please explain it to me.
Thank you.
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
Do you have any CODE that sets the type variable? The error is saying that you are trying to set "type" to "P", and the error says that "P" is the issue, not "type". Also, just add a breakpoint to that "with" line, and then run the code in the debugger and step through it line by line and you'll find the exact cause of the issue.
 
Thank you @Nouturne,
'P' is value I set when I copy log, after that, I set to 0 and take the screen shot. 'P' is the value I want to use.

I found the problem. In parent, I set 'type' variable is Real, If I change it to 'String'. It works.
 
Top