Proper Set Up of Layered Background

Posted: 07 Oct 2022 19:30
by gradstein

Hi there,

I'm a bit confused on proper layered background set up. I have a layered background with a lot of groups and layers, set up like this: LivingRoomDecor -> DecorType > Item. A room I essentially want to decorate as a player.

In the prefab, I started with every group and layer inactive except for the base room layer which was active. When I try to toggle on a layer in nn script using @back Floors>LightWood, i get an error that it cant be found.

If I start with everything Active in the prefab, but turn all groups off in script at the top between a start and finishtrans, then use the above command, it works, but thats a pretty big load.

Am I doing something wrong, or does every group and layer need to be ACTIVE in the prefab and then controlled on/off with script commands?


Re: Proper Set Up of Layered Background

Posted: 07 Oct 2022 22:29
by gradstein

Also, I'm curious... will it save the state of this background (i.e. which layers are on/off) the next time I call it? Even if its in a different script? Or do I need to drop in some booleans to track and check for them next time I call it?


Re: Proper Set Up of Layered Background

Posted: 08 Oct 2022 09:39
by idaot

You can toggle any layer on/off freely before entering play mode. Make sure you are not disabling the objects themselves, but rather enable/disable the Sprite Renderer components.

As for the state, when the actor has been unloaded via @hide or script loading process, it will return back to the default state which is either the "Default" appearance/key or the layout you left it at when entering play mode, unless you specify a different appearance/key upon calling it. You can use custom variables if you want the state to be remembered somehow, but my recommendation is to create composition maps so you can call any complex setup with a single keyword. https://naninovel.com/guide/characters. ... characters