if you're unable to reproduce bug, how we can help ? you're even not giving any code/output to prove issue.
Also, as mentioned above, you can compare instance_number with with():
Code:
var inst = 0;
with(object_name) {
inst++;
}
show_debug_message(inst);
show_debug_message(instance_number(object_name));
if both numbers are same, there's no bug.
i used this code
var inst = 0;
with(obj_parent) {
inst++; }
show_message(inst);
show_message(instance_number(obj_parent));
and both massages are giving the same result, so there is no bug i guess,
in my game i have my character move to the right, and so the mountain in background will create another instance of it self to the right when the view nears its end
var right_edge = x+sprite_width-200 //only create another instance when view is about to go beyond current instance
if right_edge < global.cam_x_right_side {
if !position_meeting(x+sprite_width+hspeed+10, y+10, object_index) {//check if there is no instance at the right
if instance_number(object_index) < 2 {//if there is less than two instances, then create an instance
inst_1 = instance_create_layer(x+sprite_width+hspeed, y, layer, object_index)//create another instance to the right
inst_1.image_xscale = image_xscale
inst_1.image_yscale = image_yscale}}
}
and this code will destroy the instence to the left as it goes out of the view, so the game always have only two mountain instances to keep its frame rate stable
if x+sprite_width+hspeed < global.cam_x {
if instance_number(object_index) > 1 {
instance_destroy()}} //destroy useless instance to the left and out of view
as you see the highlighted code above, i fixed the bug by changeing the oprator < to >
like this
if instance_number(object_index) < 2 {
it became
if instance_number(object_index) > 2 {
this is why i think there is a problem in instance_number()