Default layer for objects


#1

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.


#2

If you mean the when you drag somerhing into the scene editor, as far as I know you cannot default it to another layer.


#3

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.

Thank you!


#4

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.


#5

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.


#6

You can create the objets on layer you wish.


#7

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.


#8

“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.

Thank you!


#9

You can also shift+click multiple objects on the scene, then edit their layer in the properties panel on the left, if that helps.


#10

It certainly helps, thank you.