Cammin / LDtkToUnity

Unity importer for the LDtk level editor
https://cammin.github.io/LDtkToUnity
MIT License
381 stars 38 forks source link

Optionally don't import the background color as a separate layer #32

Closed phybros closed 3 years ago

phybros commented 3 years ago

I don't need the background color layers in my current project - it would be great to be able to uncheck an option somewhere that said "Import background color as a layer" or something like that.

Failing that, an option to set the Order In Layer for the BG color layer to -99999 😄

Love this project!!

Cammin commented 3 years ago

Hi, thanks for the suggestion! 🙂

When I was adding this background color, I was seriously considering if it should be added at all. The reason that I added it is that it helps match the visuals in the LDtk editor out of the box instead of having to custom code a flat background. And yeah, I do understand that it can become too intrusive if for example wanting to create a custom background system like parallax. I thought about making it a toggle option in the importer; the reason I chose against it originally was that it could already be manually turned off/deleted in the import result as a scene/prefab override. Though I'll give this more thought and will indeed add it eventually. Maybe even a custom ordering for the background like how you mentioned -99999.

Though I think custom sorting order would be its own bigger system, so I'd be interested if you might have any ideas. Thanks for reaching out 👍

Cammin commented 3 years ago

Add toggle to create flat color background

phybros commented 3 years ago

Awesome. How would I implement deactivating the prefab/object on import? Which gameobject should I implement the interface on, or can I just use any object?

Cammin commented 3 years ago

A neat feature about Unity's import system is that when you make object overrides (like prefab overrides), then the changes retain even after a new reimport (assuming the hierarchy does not change its names)

So if you set a gameobject inactive, it would stay inactive between reimports. 🙂

Though because it depends on remembering the gameobject hierarchy names as an intermediary between the two, it can lose these settings if some changes were made, like renaming the level in LDtk. So in that sense, it would honestly be best for me to implement more options in the importer.

I might also look at ways that the user could customize their own import process in code through inheritance perhaps. That's another interesting idea I could do so that all possible needs could be met for anyone 😉

phybros commented 3 years ago

Nice. Yeah Looks like those GameObjects stay disabled across many imports. Awesome!

You can close this if you like, or keep it open if you want to track making this a feature, but my specific issue is resolved! Thanks

Cammin commented 3 years ago

Sure, will do. If this needs to be brought up again, feel free to reopen or post another issue. Thanks 🙂

Cammin commented 2 years ago

I recently pushed a new update (2.1.8) that provides the option to not create the background color in the importer inspector. But if that doesn't work well enough, then there is also the new option to customize the hierarchy during the import process: https://cammin.github.io/LDtkToUnity/documentation/Topics/topic_CustomImporting.html#ldtkpostprocessor

Thanks for using the tool 🙂