[BUG] Calling instance functions using var will cause error

Completed

Comments

6 comments

  • YoYo QA Dept

    Hello

    Thank you for getting in touch. I have replicated the issue and a bug has been logged in our database.

    Regards

    1
    Comment actions Permalink
  • YoYo QA Dept

    Hello

    I have heard back from Core Tech on this issue and it is not a bug:

    "This is not a bug as obj_test is an object and not an instance of that object, that syntax has never worked in that way to refer to a specific instance."

    Regards

    1
    Comment actions Permalink
  • brice

    Thanks for answering, but the same error will appear if you reference an ID to a variable. For example:

    I gave a sprite to the "obj_test" and the execute object the next step event:

    var obj = instance_position( mouse_x, mouse_y, obj_test);

    if (obj != noone) {
    obj.add();
    }

    This code calls the function as an instance and show the same error. Also in the OP , shouldn't it execute the function for all the instances of the object referenced? is this intended?

    1
    Comment actions Permalink
  • Core Tech

    Please attach an example project as that should work in that case if obj contained an instance index.

    Russell

    0
    Comment actions Permalink
  • brice

    Sorry, this is the project in question

    https://www.dropbox.com/s/moc0k0usgoo6wim/Test2.yyz?dl=0 

    1
    Comment actions Permalink
  • Robert Miller

    I can confirm this error also seems to occur if you assign a lightweight object to a var when calling instance functions.  I can't confirm, but it seems like the garbage collector may be reclaiming the memory prematurely, as the error and my debugging seems to imply that the var instance disappears for no reason.

    1
    Comment actions Permalink

Please sign in to leave a comment.