Commit f37755e7 authored by Markus Schlösser's avatar Markus Schlösser
Browse files

Added Rotated Tile script

parent ef1b44b1
fileFormatVersion: 2
guid: bd38256b81432b74996cfe76823450d6
guid: c94e8bc1ef7e4474992795cf6a48a16e
folderAsset: yes
externalObjects: {}
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Tilemaps;
using UnityEditor;
public class RotatedTile : TileBase {
private enum Rotation {
[SerializeField] private Sprite sprite;
[SerializeField] private Rotation rotation;
public override void GetTileData(Vector3Int position, ITilemap tilemap, ref TileData tileData) {
tileData.sprite = sprite;
tileData.color = Color.white;
float degrees;
switch (rotation) { }
tileData.transform = Matrix4x4.TRS(, Quaternion.Euler(0, 0, GetDegrees()),;
tileData.flags = TileFlags.LockTransform;
tileData.colliderType = Tile.ColliderType.Grid;
private float GetDegrees() {
switch (rotation) {
case Rotation._90: return 90.0f;
case Rotation._180: return 180.0f;
case Rotation._270: return 270.0f;
default: return 0.0f;
public static void CreateRoadTile() {
string path = EditorUtility.SaveFilePanelInProject("Save Rotated Tile", "New Rotated Tile", "Asset", "Save Rotated Tile", "Assets");
if (path == "") return;
AssetDatabase.CreateAsset(CreateInstance<RotatedTile>(), path);
fileFormatVersion: 2
guid: 85c106dd6ad68a043a95570cbdd83ca7
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment