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

Post's attachments

Attachment icon Untitled.png 944.44 kb, 106 downloads since 2016-07-31 

Re: Resize With UI panel

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;
        }
    }
}
Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: Resize With UI panel

can you provide a component , that can map , a panel to tile set ..? means just a plug and play component??

Re: Resize With UI panel

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.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: Resize With UI panel

0k thanx