-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't select Grid prefab for project #10
Comments
Thanks! It'd also be great to be able to select a different grid prefab for the IntGrid grid and AutoLayer grid. =) |
I pushed the new update, however, the previous references of the grid prefabs will be lost, so they will need to be reassigned as GameObject prefabs. Also, got the new documentation website set up with this update :) I was wondering if you could explain your new question some more; for being able to select different grid prefabs for IntGrid and AutoLayer? Sorry, I just didn't catch what it meant exactly 😅 |
Basically, I load a level from ldtk, and I get this: My LDtk Project asset has this: What I defined in ldtk was this: So I'm able to assign grid prefabs for the original ldtk-defined layers, but I get some additional layers. Also, it looks like I'd just have to define my own tiles to match the IntGrid tile values if I wanted to be able to look up those values at runtime? Any chance of including or generating some default assets for IntGrid tiles so I don't have to manually set those up? Also, any chance of getting some data attached to the game objects so I can look up the original layer they came from? I'm trying to do some basic tilemap modification in Unity, where I'd find what IntGrid value was on a tile (from an IntGrid layer), change that tile, then also change the automap above it. It's a bit difficult to accomplish at the moment (at least without relying entirely on what the layers happen to end up being named) =/. |
I'm basically trying to use the int grid for logic, since I've defined it such that it's effectively a simplified collision map (e.g. tiles with 0 are blocked, whereas tiles with 1 are walkable). Right now I'm trying to replace tiles in a location based on the int grid value at that location. However, I'd also like to do things like pathfinding based on that simplified grid. I'm sure I could manually define sprites with that data on them to use for those tiles, but it'd be nice if that data was just available directly. It sounds like that's somewhat your aim (make the LDTK data available through the generated objects in Unity). Unfortunately, I haven't used Unity enough in my career to know the "right" way to accomplish things. I've used C# for most of my career, and have worked on engines similar to Unity in the past, but haven't dug in deep enough to have a strong recommendation for a pattern. My initial inclination would be to have a component on the generated objects with the data available, but that might not be the right way to do things in Unity. |
I believe I have a solution concerning int grid values. Also, to help allow JSON data to be communicated to the tiles during the level building process, I'm going to experiment with either an extra layer of inheritance (ex. LDtkTile) or using interfaces (ex. ILDtkTileColor, ILDtkIntGridValue). If this idea doesn't work out then I'll try something else. I'm going to add this TileBase field when I get around to it and see how it works out. It's not on my agenda right now but something I want to add to the project pretty soon. It might even show up next update; we'll see as time tells. I believe this will help out with achieving your own goals with int grid value tiles. It lends itself to a more "open nature". 🙂 |
I pushed a new major update which entirely changes the level building process to using ScriptedImporters. Check out all of its details here: https://github.com/Cammin/LDtkUnity/blob/master/Assets/LDtkUnity/CHANGELOG.md The IntGrid value fields now use a new special tile called LDtkIntGridTile (creatable in the asset menu), which has different customization options, including a game object field to allow for creating anything at a tile. Let me know what you think, or if you still have any issues with the new system that may appear lacking in the context of this conversation. 🙂 |
I'm leaving this issue as resolved, but feel free to reopen (or post new different issue) if necessary 🙂 |
I'm trying to use a different grid prefab for my levels, but the selector for Grid Prefabs isn't showing any assets, not even the default
LDtkDefaultGrid
. I'm guessing it can't see the prefabs because they're aGameObject
and just contain aGrid
, whereas the asset picker is filtering for typeGrid
.The text was updated successfully, but these errors were encountered: