Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

You’re right. ​ The problem is that I cannot simply move each room template to the position given by the generator because the position must be transformed to fit the isometric grid. Here is a hotfix for you:

using UnityEngine;

namespace Edgar.Unity.IsometricFix
{
    [CreateAssetMenu(menuName = "Edgar/Examples/Isometric 1/Position Fix", fileName = "Isometric1PositionFix")]
    public class Isometric1PositionFix : DungeonGeneratorPostProcessBase
    {
        public override void Run(GeneratedLevel level, LevelDescription levelDescription)
        {
            var grid = level
                .RootGameObject
                .transform
                .Find(GeneratorConstants.TilemapsRootName)
                .GetComponent<Grid>();

            foreach (var roomInstance in level.GetRoomInstances())
            {
                var correctPosition = grid.CellToWorld(roomInstance.Position);
                roomInstance.RoomTemplateInstance.transform.position = correctPosition;
            }
        }
    }
}

Add this file to your project, create an instance of the scriptable object, and drag and drop this instance to the “Custom post process tasks” list in the generator inspector.

It should fix both the colliders and the door positions. Let me know if that works.

it helped! thank you, veru much!

Also i found another strange moment. In template i did collisions, but after press button "Generate level" different "level 0 - floor" collisions dissepear. Do you have ideas about this?


That’s intended behavior. In the usual 2D setting, after a level is generated, all room templates are merged into a single tilemap layer (or multiple shared layers). When they’re merged, all collider layers from individual room templates are also merged into a single shared collider layer. In order to not have duplicate colliders and to ensure that it’s possible to go from one room to another, colliders from individual room templates are disabled and only the shared on is kept. This behavior can be toggled by disabling/enabling the “Disable Room Template Colliders” field in the Dungeon Generator inspector.

Also, here you can find some useful information about room template customization. The most important piece of information regarding that is that you cannot just modify a room template, e.g. by adding a collider to the “Level 0 - Floor” layer, and expect that these changes will transfer to the shared tilemaps in generated levels (“Generated Level” -> “Tilemaps”). If you want to do some modifications, you have to also change the Isometric1TilemapLayersHandler script.

Thank you!