How can I set a default layer for a particular object?
For example, I have two layers: Base and Background
And I have a sprite called BackgroundBrick
I’d like to add it directly to the Background layer as default, instead of adding it to the Base layer and then moving it to the Background layer.
If you mean the when you drag somerhing into the scene editor, as far as I know you cannot default it to another layer.
Yes, I did mean that.
I found a solution: added all my background objects to a group called Background.
Then a simple event, at the start of the scene, to move them all to the Background layer.
Hm. I don’t think you have to use an event to transfer background objects to the background layer. Click on an instance, and there it is, in the properties tab, above the “custom size?” button and below the Z order.
However, you cannot lock a layer, or select a layer and add directly to it.
Unless you mean using a whole bunch of “BackgroundBrick” instances, in which case, yeah, I can see the use of an event.
I’m planning on using parallax later, so I need them in another layer too. Just z-order won’t work, I guess.
And that layer will be built using several objects, not just a single image.
I guess my best option, for now, is using the event, and that’s fine.
You can create the objets on layer you wish.
Wait, You shouldn’t have to use events at all to move them to another layer unless you have some dire need.
I thought you meant defaulting them by dragging them to the scene.
Once they’re on the scene, just click on them and click the “layer” box on the object properties panel, once switched here they’ll stay on that layer when your game starts.
“I thought you meant defaulting them by dragging them to the scene.”
It’s exactly that. I just don’t want to set their layer manually, one by one. I expected to be able to, I don’t know, maybe first select the layer, then, when dragging objects, just have them added to the selected layer, or something like that.
You can also shift+click multiple objects on the scene, then edit their layer in the properties panel on the left, if that helps.
It certainly helps, thank you.
That’s an issue I face every time…
The idea would be to reduce the number of repetitive manual tasks we have to perform, and thus the risks of mistakes (forgetting to send cloud in the background).
So, if a create an object specifically for a layer (cloud in background), I would expect that its default behaviour would be to be send to that layer drag and dropping it in the scene.
If the editor does not allow it, then I would definitely use an event as described above (or create a costum behaviour).
Less work. Less things to worry about. Less mistakes. More fun in creation.
You can always use this to make sure in my case “Hand” must always in layer “MainMenu”
Of course it would be great if GDevelop recognizes the active layer or has a check like in Construct where you can isolate a layer that would be a nice feature.
My Problem is I have set the objects to the layer, in the scene editor i have them in the specific spot I want them. But when I enter the game anything that isn’t the base layer end up moving into a separate location in the background instead of being in that specific spot?
That’s correct behavior. Each layer has it’s own unique camera.
If you are using multiple layers that you want to align, you will need to replicate your camera events for each layer.