Tilemap Extras preview package is now available

Hello, we’re on Unity 2020.2.3, and the package shows up by default as version 1.6.3, but even after using “+” for git URL and adding “com.unity.2d.tilemap.extras” it is still at that version.

Are there going to be breaking changes / deprecations if we begin with 1.6.3 and upgrade later? Is there some other way to force it to find the 2.0.0 version? Thanks!

6880565--803732--upload_2021-2-26_9-9-25.png

EDIT: omg I just noticed you said “2021.x” – I’m so used to seeing 2020.x. Don’t mind me, just being dense… :sweat_smile:
I’m still curious about the question on deprecation as we’d likely upgrade in the future.

1 Like

Tried to find answers on this, but didn’t find too much so thought I could ask here.

Is it possible to (with the the Tilemap Extra) use the autotile when calling Tilemap.SetTile during runtime (via code)?
Thanks in advance!

For anyone else wondering this, I tried around myself and found you can indeed use the autotile via code! :slight_smile:
Here’s a good tutorial on how to set up autotiling. When you’ve done so, you can simply call it at runtime like so:

public class TestSetTile : MonoBehaviour
{
    public Tilemap tilemap;
    public RuleTile ruleTile;

    private void Start()
    {
        tilemap.SetTile(new Vector3Int(0, 0, 0), ruleTile);
        tilemap.SetTile(new Vector3Int(1, 1, 0), ruleTile);
    }
}

Thank you for adding this package into Unity! What an absolutely fantastic tool :slight_smile:

Hi, right now there are no breaking changes or deprecations. If this were to happen, we will add it in the changelog and announce it as well.

1 Like

Nice Package !

1 Like

I agree, nice package!

1 Like

I think the link broke some time between now and when you posted it, its giving me a 404 error

Ah yes, sorry, it is indeed broken as we have merged in this change to master. Please ignore that link and you can instead retrieve the changes from the master branch (or 19.4 branch depending on the version of Unity you are using).

Where do I find the changelog for version 2.0?

You can find it at: https://github.com/Unity-Technologies/2d-extras/blob/package_2021.1/CHANGELOG.md for now.

You should be able to view it from the Unity Package Manager eventually from the “View changelog” link, but that may take sometime before it is posted.
6967373--821102--upload_2021-3-24_9-51-56.png

1 Like

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):

public IsometricRuleTile();

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

You could inherit from IsometricRuleTile directly if you think you will not need custom rules, or create a IsometricRuleTile with Custom Rules (IsometricRuleTile) 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.

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:

public class RedstoneBaseTile : IsometricRuleTile, IHaveUniqueID
{
    public uint UniqueID { get => _uniqueID; }
    [SerializeField] private uint _uniqueID = 1;


#if UNITY_EDITOR
    [ContextMenu("Generate New ID from database")]
    public void GetNewGUID()
    {
        _uniqueID = DatabaseTile.Instance.GetNewID();
        UnityEditor.EditorUtility.SetDirty(this);
    }
#endif
}

Thanks for the reproduction example!

We have a preliminary fix at https://github.com/Unity-Technologies/2d-extras/commit/e9aebe22a94705bd316a1290e2070d6abad5dd57, which will be test internally and validate before updating the package in the Unity Package Manager. Hope this helps!

That’s amazing! It certainly does, thank you for the lightning fast help + fix :slight_smile:

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 :slight_smile:

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!

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.

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 .

7006262--828464--GIF.gif

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-Technologies/2d-extras/blob/master/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!