Topic: Resize With UI panel
Hi !
i m integrating map with unity ui , using tileMap for mobile performance , but could not find a way to resize and position Tile map , according to refereed Rectranform ...
plz help me to solve this issue. thanx
You are not logged in. Please login or register.
Infinity Code Forum → Online Maps Help → Resize With UI panel
Hi !
i m integrating map with unity ui , using tileMap for mobile performance , but could not find a way to resize and position Tile map , according to refereed Rectranform ...
plz help me to solve this issue. thanx
Hello.
Basic example how to make full-screen Tileset attached.
I hope that helps you fine-tune it for the panel.
Requires Online Maps v2.4.0.54+ and Camera / Projection - Orthographic.
using UnityEngine;
public class FullscreenTileset:MonoBehaviour
{
public Camera mapCamera;
private int tilesetWidth;
private int tilesetHeight;
private OnlineMaps map;
private void Start()
{
map = OnlineMaps.instance;
tilesetWidth = map.tilesetWidth;
tilesetHeight = map.tilesetHeight;
UpdateSize();
}
private void Update()
{
UpdateSize();
}
private void UpdateSize()
{
float height = mapCamera.orthographicSize * 2;
float width = height * Screen.width / Screen.height;
int h = Mathf.RoundToInt(height);
int w = Mathf.RoundToInt(width);
int wOff = w % 256;
int hOff = h % 256;
if (wOff != 0) w = (w / 256 + 1) * 256;
if (hOff != 0) h = (h / 256 + 1) * 256;
if (w < 512) w = 512;
if (h < 512) h = 512;
if (w != tilesetWidth || h != tilesetHeight)
{
OnlineMapsTileSetControl.instance.Resize(w, h, w, h);
map.transform.position = map.transform.position - new Vector3((tilesetWidth - w) / 2, 0, (tilesetHeight - h) / -2);
tilesetWidth = w;
tilesetHeight = h;
}
}
}
can you provide a component , that can map , a panel to tile set ..? means just a plug and play component??
Tileset - is not UI element. It is a dynamic mesh.
Example of how to change Tileset size depending on the size of the screen I gave above.
You need a little modify this example to the size of your panel.
0k thanx
Infinity Code Forum → Online Maps Help → Resize With UI panel
Powered by PunBB, supported by Informer Technologies, Inc.