SceneInstancesCount not working right

When I use the SceneInstancesCount expression in extensions, it does not work right. I think it happens because its set up like "SceneInstancesCount(Object) because it quite literally will only work if the objects name is the same as the expression rather than parameter. Im using this expression on Scene pre-events and on-Created but idk if that has anything to do with it. Im also using a behavior for this.

I believe you’re correct. Behaviors only see themselves.

Behaviors events run at every frame like scene events do. The main difference is that behaviors are focused on the object they are attached too. Only the attached object can be used in the events that constitute the behavior’s logic.
https://wiki.gdevelop.io/gdevelop5/behaviors/events-based-behaviors/

Plus, I don’t think the object is even created yet in the on created
(edit: objects do exist at this point)

You could do it through a function triggered from a scene or probably through Javascript.

On created works fine, its just the expression only works on the one object.

1 Like

If the expression was like Object.SceneInstancesCount() i think it would work.

EDIT: i might’ve figured out an alternative way to do this, I’ll give an update you tomorrow.