- Home /
Automatically tiling a SPRITE in the editor
Hello. I would like to have a single sprite object [64x64] that is automatically tiling when I resize it in the editor [like for walls, fences and stuff] I know how I would do that with a TEXTURE in theory, but the problem is when I connect two textured walls, they have those flickery lines between them - whatever I do, and however much I google. Therefore I use sprites. They work fine, but simple walls, but not for stuff that should be tiled when resized [like fences]
Now. I thought about doing something like this[C#]:
[ExecuteInEditMode()]
- for the script to work in the scene view [first time I use it so no idea, just googled it]
material.mainTextureOffset = new Vector2((int)transform.localScale.x, (int)transform.localScale.y);
As a simple test of resizing. I would like it to change the materials tiling values, according to the objects scale in scene
The problem is, sprites can not be tiled - even when I change the materials tiling values in the editor, they revert back to 1.
Can it be done somehow? An easy way? I don't fancy having flickery lines [using normal textures], OR having to place 100 single 64x64 tiles by hand ...
Your answer
Follow this Question
Related Questions
Tilemap: Resizing Tiles? 1 Answer
Why do they hide behind the tiles? 1 Answer
2D Character sprite resizes itself on movement 0 Answers