Closed vgf89 closed 2 years ago
I could certainly add that. I was considering if this should be an option via scripting so that there is less bloated information in the importer inspector, while also giving the user lots of flexibility.
The way I was thinking of going about it, is to follow a similar workflow like how Unity's AssetPostprocessor
works, where the user could inherit from a class (for example,) like LDtkPostProcessor
, and then override such functions like OnPostProcessLayer
, OnPostProcessLevel
, etc. Then at that point, the user could determine the name of their gameobject to apply component changes/additions accordingly. For your case for example, you could check if a layer is named "water", and then get the composite collider to modify as you may need.
This way, any niche needs could be met.
My general consideration whether I should add options to the importer inspector UI, is if it's commonly needed enough, then it could be added to the inspector UI. I wouldn't deem this as necessary in the UI so it could be handled by script instead, but please persuade me if you think it seems like a common enough need that it's worth adding into the importer inspector UI 🙂
I could get started on this feature relatively soon, It definitely feels like a necessary feature that everyone could benefit from. I'll link a trello task so you can gauge when it will eventually be added 🙂
I've used the AssetPostProcessor with blender files for previous project and it worked well. Something similar to that would be perfect!
I've been working on this, It's relatively finished but I shall push out the update once I'm done making documentation for it. As of recently in a small project of mine, I've also needed to be able to set the geometry type to polygons, so I understand the value of this feature 🙂
I've pushed a new update (2.1.8) that adds the ability to customize the import process with scripting, check it out: https://cammin.github.io/LDtkToUnity/documentation/Topics/topic_CustomImporting.html#ldtkpostprocessor
For example, for your situation, you could get all composite colliders in the hierarchy, and change the geometry type.
Let me know if it works for you or if you have any issues, feel free to reopen the issue :)
The Composite Collider Geometry Type defaults to Outlines. This is problematic as using an IntGrid as a trigger area (i.e. for checking if the player is inside water) doesn't work since only the outline collides in that mode.
My current workaround is to change the geometry type every time I add a level, but this is tedious, especially if I ever have to add an ldtk file to a different scene for any reason (since I would then have to go into all of the levels and switch the geometry type). Alternatively I could turn off Composite Colliders, but that presumably has a performance cost.
Could the Geometry Type option be added to the importer so that I don't have to manually change it for every new level?