Interact with prefab children outside of the prefab editor

The cases you described above are not a good fit for custom objects apart from the animation but it’s very specific and an external tool like Spine is probably a better option.
Custom objects are mainly useful to put things together that don’t need to interact outside of the custom object, for instance a dialog box.

Usually, behaviors are a good choice for anything that is related to movement.

Spine is not free, in fact it is very expensive, which means I can’t even dream about using it, which is very depressing because it is a powerful tool indeed.

Also the big difference of using the ability to create childs instead of using behaviors for object creation is the amount of extra steps, and the convenience of using the custom object a folder/group to organize related objects and their events. I did said that I know this is not the intended usage for custom objects. Custom objects have s lot of potential that would increase a lot given the option to make them interact with the stuff on the scene. Besides of the benefits of not having to use “for each” events (which are a headache), behaviours also do the trick but require a lot of extra steps, setups, and are way less beginner friendly.

changed the name of the request,

It looks like they’re working on the “prefab” objects. I hope it comes out soon. They’re working on an editor plus an extract objects to custom object feature. I know it’s not what you’re asking for but it gives me a little hope. They haven’t made a lot of changes to the custom objects. This looks like a good sign that they might be fully embracing them.

From the release notes
https://github.com/4ian/GDevelop/releases
A new, work-in-progress, visual editor for custom objects (aka “prefabs”/“templates”) is being finalized. More information about it will be available in the next releases.

:warning: These are the features still in progress:

  • Properly handle effects (disable 3D effects) for layers
  • Handle hot reloading properly
  • Avoid duplicating the configuration of the custom object inside each object created from it.
  • Add a “Extract as a custom object (“prefab”)” when selecting instances in a scene.
  • Ensure physics and pathfinding behaviors work properly.
  • New expressions to translate coordinates from the parent to the local custom object.
  • Ensure deletion of a custom object is gracefully handled by the editor
1 Like

that part of the update gives me hope, If they give prefabs a chance, we could develop games more modularly (besides making “for each object” events basically obsolet).

1 Like

That post just made me realise that making responsive scenery would be easier and more manageable if this feature was added.

found another use case

This one was a bug because the same object instance was the floor and the wall which the platformer character wasn’t handling well, but it has been fixed.

1 Like

I don’t see how custom objects are related to this either. It’s a feature request on Sprites.

In the last note of the comment I said that this feature could be used as a work around until or if that feature request wasn’t added, the method would be using children of a prefab as the hitboxes (to replicate the system I was describing) but that only works if the collisions of the children can be checked individually outside of the prefab editor.
This can be done already with behaviours but it can be done way better and faster with prefabs in a more self contained way.

Usually a workaround implies that it can actually be done in the current release. Otherwise, it’s not a workaround but another feature request which purpose can’t only be to workaround something.

You’re correct, fut this feature can facilitate many workarounds, not just that one.

I’m more interested in this statement.
Can u explain to me how they’re going to let you use less “for each” events? …i’m a newb on the matter.

1 Like

when an event is on an object’s behaviorFunction or on a prefabFunction it counts as if it already was on a “for each object” condition, because every instance of the object is “running its own events”.

I use objects as containers of events/behaviors and wish to use prefabs as containers of tightly related objects with heavily interconnected behaviors.

I understand what you want.

aren’t they childs of object?..cos you said instance…just asking

1 Like

intances of Object.childObject?

They’re called children for a reason.
how can this reduce the number of “for each” to use?

1 Like

“for each object” I forgot to add "object " when I wrote that.

I know, but they are instances too when they are on the scene, I used the word instance to mean “every Copy of the object existing on the scene”.

1 Like

Good :wink:.
I went in depth cos “for each” is something i prefer to avoid too…

1 Like

there was one for each event that I could not avoid, because I don’t know how it works so I rather not touch it. But I was able to replace the “for each Object” with a behaviour.