Search Unity

Official Tilemap Extras preview package is now available

Discussion in '2D' started by rustum, Sep 2, 2020.

Thread Status:
Not open for further replies.
  1. Rocky_Unity

    Rocky_Unity

    Joined:
    Oct 13, 2017
    Posts:
    96
    Hello! I need to add a field containing an I.D. number to my IsometricRuleTiles.

    I was wondering if I should inherit from
    IsometricRuleTile<T>
    , , or if I should effectively redefine my own
    IsometricRuleTile<T>
    and just copy the contents of that class into my own (which is this):
    Code (CSharp):
    1. public IsometricRuleTile();
    2.  
    3. public sealed override Type m_NeighborType { get; }
    and then just inherit from
    IsometricRuleTile


    and just add in my ID field there. I am confused by what I should inherit from to define my own tile, not for custom rules, but just for a little extra data sprinkled in (I need to network and 'save to disk' my tiles, hence the ID number).

    Second question: Can you not use
    [SerializeField]
    ? The field doesn't appear in the inspector, only public fields do. This is not ideal because it makes exposing interface variables more difficult
     
    Last edited: Mar 25, 2021
  2. ChuanXin

    ChuanXin

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    1,068
    You could inherit from IsometricRuleTile directly if you think you will not need custom rules, or create a IsometricRuleTile with Custom Rules (IsometricRuleTile<T>) without defining new Rules, which would be the same as inheriting from IsometricRuleTile with custom rules support. You will be able to add your own fields with both methods.

    We will check this out! You should be able to use this for showing the field in the inspector.
     
  3. Rocky_Unity

    Rocky_Unity

    Joined:
    Oct 13, 2017
    Posts:
    96
    Aaah ok, for clarification in your investigation, it definitely does not expose the variable on my setup, which is:

    Unity 2020.3.1f1
    2D Tilemap Extras 1.6.4-preview

    using the following syntax:
    Code (CSharp):
    1. public class RedstoneBaseTile : IsometricRuleTile, IHaveUniqueID
    2. {
    3.     public uint UniqueID { get => _uniqueID; }
    4.     [SerializeField] private uint _uniqueID = 1;
    5.  
    6.  
    7. #if UNITY_EDITOR
    8.     [ContextMenu("Generate New ID from database")]
    9.     public void GetNewGUID()
    10.     {
    11.         _uniqueID = DatabaseTile.Instance.GetNewID();
    12.         UnityEditor.EditorUtility.SetDirty(this);
    13.     }
    14. #endif
    15. }
     
  4. ChuanXin

    ChuanXin

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    1,068
  5. Rocky_Unity

    Rocky_Unity

    Joined:
    Oct 13, 2017
    Posts:
    96
  6. Rocky_Unity

    Rocky_Unity

    Joined:
    Oct 13, 2017
    Posts:
    96
    There is one more bug that I found in regards to IsometricRuleTiles.
    The MirrorX function still operates on the Cartesian aspect of the, 'inspector rule setter'
    Example,

    I would expect the following to mirror the rule to look like this:
    Original:
    Mirrored:

    But what happens is this:
    As in, it is mirroring this coordinate system as if it is still cartesian (the "upper left" direction being the "top")
    I'm not worried about the other Mirror functions because they don't play nice with how Isometric tiles have to be sliced, but a MirrorX would be nice :)
     
  7. ChuanXin

    ChuanXin

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    1,068
    The Mirror effect is based on the Grid axii, so the X axis would be in the upper right diagonal and the Y axis would be in the upper left diagonal. The icon doesn't really showcase this unfortunately! Let us see if we can do something about that!

    If you want to have the above behaviour, it is possible to override the RuleTile to produce this. Let us know if you need help with this!
     
  8. LeopoldBloom

    LeopoldBloom

    Joined:
    May 31, 2013
    Posts:
    5
    Is there a way to use the random brush to paint a multi-tile pattern where each tile in the pattern is randomized from a set?

    For example, say I have the below tiles:

    AB CD EF

    I want to paint a 2x2 pattern of the form XY, where X is a random tile selected from A, C, E and Y is a random tile selected from B, D, F.
     
  9. LeopoldBloom

    LeopoldBloom

    Joined:
    May 31, 2013
    Posts:
    5
    Also, is this a bug or a feature? Tiles painted onto the tilemap always face up, regardless of their rotated orientation in the palette. Rotating with [ ].
     

    Attached Files:

    • GIF.gif
      GIF.gif
      File size:
      983.7 KB
      Views:
      290
  10. ChuanXin

    ChuanXin

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    1,068
    I guess that is possible if you use the Random Brush as is. You will need to create the different permutations for each combination of A, C, E and B, D, F that you want.

    You would be better off customising the Random Brush code (https://github.com/Unity-Technologi...ter/Editor/Brushes/RandomBrush/RandomBrush.cs) a little further to get the pattern that you want. Instead of choosing from random Tile Sets, you would build your own Tile Sets from a random combination of A, C, E and B, D, F (or more).

    Let us know if you need help with this!
     
  11. ChuanXin

    ChuanXin

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    1,068
    This seems like a bug! Could you share the version of the Unity Editor you are using and your setup for your project which results in this issue? Thanks!
     
  12. LeopoldBloom

    LeopoldBloom

    Joined:
    May 31, 2013
    Posts:
    5
    Thanks! I will tweak it accordingly.
     
  13. LeopoldBloom

    LeopoldBloom

    Joined:
    May 31, 2013
    Posts:
    5
    Unity Version: 2021.1.0f1

    I played with it more this morning and determined that it is a bug with a specific grid.

    If I add a new tilemap to the same grid, that tilemap also has this problem.

    If I create a new grid (hierarchy right click, 2d object, tilemap, rectangular) in the same scene, the new tilemap object does not have this problem. Both grids were created with default settings. Perhaps the original got corrupted in my messing around with tilemaps and pivots.

    I cannot reproduce it in a new grid / tilemap / scene / project.

    I submitted the bug (case 1326880) with the project files needed to reproduce it through the bug reporting system for the record, but not a huge issue given it is so hard to reproduce.
     
  14. ChuanXin

    ChuanXin

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    1,068
    Thanks! We will check it out!
     
  15. Deleted User

    Deleted User

    Guest

    Thanks! I was wondering why I couldn't see 2D Tilemap Extras in the package manager in 2020.3.3f1... :)
     
  16. Zephus

    Zephus

    Joined:
    May 25, 2015
    Posts:
    356
    Would it be possible to add some kind of "comments" to the tilemaps? I'm using rule tiles extensively, and I'm at a point where I can't really tell which tile is which without a reference sheet. It would really help if I could add text to the tilemap, or tooltips for individual ruletiles.

    Also, I think the rule tile override UI is broken. On the left is the original and on the right the override:
     
    Last edited: Apr 15, 2021
  17. ChuanXin

    ChuanXin

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    1,068
    We do have an example brush script here which you can use to display the coordinates of where your cursor is hovering. You could modify this to add more information, such as the Tile asset you are hovering over and so on.

    If that is not what you require, could you share what comments would you like to be able to add onto the Tilemap and how you would like to be able to visualise them? Thanks!

    Could you share which version of the Unity Editor you are using? We will check this out! Thanks again!
     
  18. Zephus

    Zephus

    Joined:
    May 25, 2015
    Posts:
    356
    Oh, this is for visualization in the Scene View, right? I meant that I'd like comments in the Tile Palette. I've made an example of something that would help me a lot:



    1. I think a tooltip would be the most helpful solution - when hovering over a tile a tooltip with the tile name could appear. As you can see in the Inspector it's called "Square Blue". Now imagine I have a lot of different rule tiles that look similar. This would make it much easier to verify which tile I'm about to select.

    2. I could also imagine showing the tile name on the bottom of tile palette (so that the information from 2. in the Inspector could also be shown at 2. in the tile palette). Maybe it would also make sense to put this at the top under "Active Tilemap", as I think the actively selected tile is a pretty important piece of information that should be visible somewhere in the palette itself.


    I'm using 2021.1.3f1 and the newest version of the tilemap packages (extras 2.0.0). I just noticed the problem extends to normal rule tiles as well. For some reason the sprites are shown way too large:
     
    Last edited: Apr 19, 2021
    Xiangting_Su likes this.
  19. ChuanXin

    ChuanXin

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    1,068
    Thanks! We will see what we can do about this!

    We will check this out too!
     
  20. rustum

    rustum

    Unity Technologies

    Joined:
    Feb 14, 2015
    Posts:
    190
Thread Status:
Not open for further replies.