0
\$\begingroup\$

Let's say, I have three objects: obj_square, obj_circle and obj_triangle.

Instances of all three types of objects exists in the room and call the same script: scr_test.

Inside of this script, how can I check instance of which object is calling it?

Pseudocode:

if(self is instanceof(obj_circle))
{
// do stuff
}
\$\endgroup\$
2
\$\begingroup\$

object_index

This read only variable returns the index of the object that the instance has been created from.

So your code would read:

if(object_index == obj_square) {
    // ...
}
\$\endgroup\$

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.