On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Better Rule Tiles for Unity

Creating tilesets was never easier than this! · By Vinark117

Bug reports Sticky Locked

A topic by Vinark117 created Sep 25, 2022 Views: 416 Replies: 15
This topic was locked by Vinark117 Nov 04, 2023

Bug reports have moved to GitHub, please report future bugs there.

Viewing posts 1 to 9
Developer (3 edits)

Bug reports moved to https://github.com/Vinark117/BetterRuleTiles-Support/issues

When trying to build (unity 2022.3.0.f1) for windows I run into the following error:

BetterRuleTiles\Editor\EditorTools.cs(14,19): error CS0103: The name 'EditorGUILayout' does not exist in the current context.

Wrapping the whole EditorTools class in #if UNITY_EDITOR will result in a succeeded build
Developer

Thank you for reporting the bug. It seems like I forgot to do that, will be fixed in the next update.

(I'm using Unity 2022.3.9f1)

Bug: when using 'light' GUI theme, buttons in Better Rule Tile editor window are nearly un-readable.

Bug: toolbar button images are bit too large and "hang off" the bottom of the buttons

Maybe not a bug, but a code-smell: In Runtime/Scripts/BetterRuleTileContainer.cs, there are several functions with code like this:

    var cell = _grid.Find(t => t.Position == tiles[i].Position );
    if (cell != null) cell = tiles[i];
    else _grid.Add(tiles[i]);

In this case 'cell' is not used and the assignment will likely be optimized away, but the code is misleading (there are several variants of this code in the various Area / Block functions.

Developer (1 edit)

Thank you for reporting the issues, I'll change the colors of the backgrounds when in light mode so the UI will be readable.


Also you were right about the the code snippet, this is what it should've been from the start:

var cell = _grid.Find(t => t.Position == tiles[i].Position);
if (cell != null) _grid[_grid.IndexOf(cell)] = tiles[i];
if (cell == null) _grid.Add(tiles[i]);

You unintentionally reported another bug with this, as this was the reason why pasting and moving things over already placed tiles didn't behave as supposed to have. So thanks for reporting this as well.

Developer

Thank you again for reporting these issues. A new update is now available with fixes.

I don't know if I'm declaring wrong the Tile Rules, but I think I'm doing what is expected, and found this issue.
Using Unity 2022.3.0

I created 64 Hex tiles for all the possible combinations of outside walls per Hex.
Did all the rules, and when I use them, most of them do what expected, but some behave weird.

I could share a Unity package with the tiles and rules already set up, if this helps finding the issue.

or probably is not a bug and I'm just doing it wrong.

Other example, the issue seems to happen with Diagonal Tiles, but it works with Horizontal.

Developer (1 edit) (+1)

Thank you for reporting the issue, I'll look into it and get back to you once I find something.

Edit: I've found the cause of the issue, and the bug should be fixed in the next update.

(2 edits)

I am using Better Rule Tile for version 1.41 Unity version is 2021.3.29f1 I am using macOS 12.7.

I encountered two problems. The first one is the annoying alert sound. Sometimes, when I press the selected shortcut key ‘S’ in the plugin, or some other  shortcut keys, it triggers the Mac system’s operation prohibition alert sound. However, the function can be triggered normally. The second problem is that sometimes the console will report an error. The error message is as follows:

Thanks for your help and the great tool!

NullReferenceException: Object reference not set to an instance of an object

VinToolsEditor.BetterRuleTiles.EditorGridBase.DrawInteractiveMiniGrid (UnityEngine.Rect rect, VinTools.BetterRuleTiles.BetterRuleTileContainer+GridCell cell) (at Assets/BetterRuleTiles/Editor/EditorSubClasses/EditorGridBase.cs:552)

VinToolsEditor.BetterRuleTiles.BetterRuleTileEditor.GridCellInfoWindow (System.Int32 windowID) (at Assets/BetterRuleTiles/Editor/CustomEditor/BetterRuleTileEditor.cs:1846)

VinToolsEditor.BetterRuleTiles.GUIWindow.WindowGUI (System.Int32 WindowID) (at Assets/BetterRuleTiles/Editor/EditorSubClasses/GUIWindow.cs:134)

UnityEngine.GUI.CallWindowDelegate (UnityEngine.GUI+WindowFunction func, System.Int32 id, System.Int32 instanceID, UnityEngine.GUISkin _skin, System.Int32 forceRect, System.Single width, System.Single height, UnityEngine.GUIStyle style) (at /Users/bokken/build/output/unity/unity/Modules/IMGUI/GUI.cs:1914)

UnityEditor.EditorWindow:EndWindows()

VinToolsEditor.BetterRuleTiles.BetterRuleTileEditor:DisplayWindows() (at Assets/BetterRuleTiles/Editor/CustomEditor/BetterRuleTileEditor.cs:897)

VinToolsEditor.BetterRuleTiles.BetterRuleTileEditor:OnGUI() (at Assets/BetterRuleTiles/Editor/CustomEditor/BetterRuleTileEditor.cs:388)

UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&) (at /Users/bokken/build/output/unity/unity/Modules/IMGUI/GUIUtility.cs:189)


GUI Error: Invalid GUILayout state in BetterRuleTileEditor view. Verify that all layout Begin/End calls match

UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&) (at /Users/bokken/build/output/unity/unity/Modules/IMGUI/GUIUtility.cs:189)


GUI Error: You are pushing more GUIClips than you are popping. Make sure they are balanced.

UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&) (at /Users/bokken/build/output/unity/unity/Modules/IMGUI/GUIUtility.cs:189)

Developer

Thank you for reporting the issues. The error messages are something that I'm actively trying to get rid of and already managed to remove a lot of them, but there are still some edge cases. When rebuilding the scripts in unity the editor loses the references to every private object I've created, so when that happens I have to recreate those lost objects. Normally I check for them before I use those objects, but there are a few things that I still need to add checks for, but if the errors do show it only happens for one frame, than the objects get recreated.

About the MacOs bug, unfortunately I can't test that out as I don't have a mac, but if you know how the problem could be solved, please let me know, so I can fix the issue.

The error with the alert sound doesn’t trigger every time, I’ll debug it and let you know the conclusion. There’s another bug, when I move a window in the editor to another window area, the toolbar where the export button is located in the editing scene of Better Rule Tile disappears. If I switch to another window of this plugin, it can be restored, but the original window can only be restored by closing and reopening it.

English translation: I’m sorry, but I’ve found some minor issues. The image below shows the results of material layout in two scenarios, the left side is the better rule tile, and the right side is the default tile palette. In my materials, some are large images composed of many small squares, and some are small tiles. In the tile palette, everything is normal after dragging the image in. However, in the better rule tile, the entire large image is recognized as a small piece of material. How can I fix this?



Developer

If you select the image file (that was sliced into multiple sprites) and drag that into the editor it will keep the layout of the sprites. When selecting multiple individual sprites and dragging those in, the tool treats them as just sprites, and does not recognize that those sprites are part of the same texture, so it just lays them out from left to right.

If the problem is still present after trying this please report back to me, because in that case it is a bug.

(2 edits)

I may not have expressed myself clearly. The sprite sheet image I dragged in have been edited by me. Some of the tiles are 16*16, and some sprites are larger, such as houses and trees. However, when I put them into the better rule tile editor, they did not maintain their original state.The larger sprites has been scaled into 16*16.

Developer locked this topic