#```cs

1 messages · Page 1 of 1 (latest)

finite plank
#

Why are the tile flags not TileFlags.None?

#

Why is the tile flag LockColor?

#

Is SetTileFlags only additive?

hallow creek
#

you assign a different tile after changing the tileflags

#

does the selectionTile have its tileflags set to none?

finite plank
#

Ok so... the flags etc are associated with the tile itself, not the tilemap or a position in the map?

#

That's quite annoying

#

but I can work with it

#

Ok yes - if i reverse those two lines it works.

#

so if I want that tile in two different colors I need to Instantiate the tile?

hallow creek
#

yeah the TileFlags are a property on the actual TileBase, it seems that the method on the Tilemap just changes that property (on the c++ side annoyingly so it's not exactly clear in the script bindings)

#

the docs and scriptbindings aren't exactly clear, but theoretically just calling SetColor should be enough, i don't think you would have to instantiate the tile yourself to change its color.
i'll have to go consult some old projects to see how i handled it though

finite plank
#

It seems like if i call SetColor alone it doesn't work because the tile flags are set to Lock Color by default

#

unless that's a thing I can change... somewhere in the inspector of something?

hallow creek
#

well i mean after setting the tileflag it should work

finite plank
#

it does, yeah

#

ok that's weird yeah why does that work

#

That's with this code:

            AddShape(new Shape {
                Color = new Color32(255, 0, 0, 100),
                Positions = new Vector2Int[] {
                    new(0, 20),
                    new(1, 20),
                    new(2, 20),
                    new(3, 20),
                    new(4, 20),
                    new(5, 20),
                }
            });
            
            
            AddShape(new Shape {
                Color = new Color32(0, 0, 200, 100),
                Positions = new Vector2Int[] {
                    new(0, 22),
                    new(1, 22),
                    new(2, 22),
                    new(3, 22),
                    new(4, 22),
                    new(5, 22),
                }
            });```
AddShape simply runs that previous block of code in a loop for each of those positions
#

I assumed since they're using the same TIleBase, setting the color would apply to all instances of that tile in the map

#

I'm definitely missing something about how this works

hallow creek
#

yeah it's weird. whatever is allowing it to work is happening on the native side though because all of these methods on the tilemap class are extern

finite plank
#

Ok I can't believe I spent as much time on this stupid utility as I have. THis was supposed to be a 10 minute diversion so I could make a quick drawing utility for some other code to use lol

#

I failed to account for learning time