I know that using object IDs is very anti-pattern in GDevelop. Okay, I accept that. But please can we get some way to save one (or some) instance(s) of an object as a variable? Or failing that the ability to use expressions to reference objects within actions instead of only being able to pick from a list?
My big use case is actions that require two objects that one wants to use on two instances of the same object. Say, a vehicle building game where you want to create a weld joint between two identical vehicle parts. Yes, you could create separate game objects like Wheel1 Wheel2 Wheel3 etc, but this is extremely cluttered and can really become messy when you start loading objects from external layouts or even external data entirely.
We could easily pick one of said wheels, save it for later as a variable, then pick the other wheel and run a physics joint create using the object and then the variable. Equally if we could use expressions there could be some sort of function like “getClosestObjectByName(“Wheel”,TargetX,TargetY)” or something along those lines, or use the Stack extension, as that acts a lot like an array of objects.
As is you seemingly must use an intermediate object of some sort for these physics joints. Again, this is a workaround that works, but it’s extremely clunky and messy when you should be able to just reference two different instances.
I tried using a physics joint create action that absolutely positively only picked two instances of the same object (confirmed by using other actions on them) and it simply didn’t work.
If this is something I could do with extensions, or within JavaScript, please let me know.
Thanks!