<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Infinity Code Forum — How can I make a 2D map fullscreen?]]></title>
	<link rel="self" href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=661&amp;type=atom" />
	<updated>2017-10-02T23:00:09Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.infinity-code.com/viewtopic.php?id=661</id>
		<entry>
			<title type="html"><![CDATA[Re: How can I make a 2D map fullscreen?]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=2880#p2880" />
			<content type="html"><![CDATA[<p>This is because the map must have a size of 256 * N.<br />You can set any RectTransform.sizeDelta to have a size of the map equal to the size of the canvas, but if it is different you will lose the aspect ratio.</p><p>I just checked the work of the map and script with &quot;Screen Space-Camera&quot;, and it works well.<br />Perhaps the problem is in some other setting.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2017-10-02T23:00:09Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=2880#p2880</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: How can I make a 2D map fullscreen?]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=2877#p2877" />
			<content type="html"><![CDATA[<p>Thank you, Alex Vertax!</p><p>The script works great! Though I noticed that the card goes beyond the canvas a bit (a UIRawImage 2D map can only be created as a canvas child), should it be so?</p><p>I also noticed that I can&#039;t use a UIRawImage 2D map if the canvas-parent is set to &quot;Screen Space-Camera&quot;. In this case, the card is not aligned to the canvas. Will the &quot;Screen Space - Camera&quot; canvas be supported for a 2D map in the future?</p><p>Thank you!</p>]]></content>
			<author>
				<name><![CDATA[Rumata]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=537</uri>
			</author>
			<updated>2017-10-02T21:06:46Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=2877#p2877</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: How can I make a 2D map fullscreen?]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=2875#p2875" />
			<content type="html"><![CDATA[<p>Better to use UIImage or UIRawImage.<br />GUITexture is the worst choice, because it uses the old UI system.<br />In Online Maps v3 GUITexture control will be removed.</p><p>Example of how to make the adjustment of the map size to the screen size for Raw Image:<br /></p><div class="codebox"><pre><code>using UnityEngine;
using UnityEngine.UI;

public class AdjustMapToScreen3 : MonoBehaviour
{
    private int screenWidth;
    private int screenHeight;
    private Texture2D texture;

    private void ResizeMap()
    {
        screenWidth = Screen.width;
        screenHeight = Screen.height;

        int mapWidth = screenWidth / 256 * 256;
        int mapHeight = screenHeight / 256 * 256;
        if (screenWidth % 256 != 0) mapWidth += 256;
        if (screenHeight % 256 != 0) mapHeight += 256;

        if (texture != null)
        {
            if (mapWidth == texture.width &amp;&amp; mapHeight == texture.height) return;
        }

        texture = new Texture2D(mapWidth, mapHeight, TextureFormat.RGB24, false);
        OnlineMaps.instance.SetTexture(texture);
        OnlineMaps.instance.RedrawImmediately();

        RawImage rawImage = GetComponent&lt;RawImage&gt;();
        rawImage.texture = texture;
        RectTransform rt = transform as RectTransform;
        rt.sizeDelta = new Vector2(mapWidth, mapHeight);
    }

    private void Start()
    {
        ResizeMap();
    }

    private void Update()
    {
        if (screenWidth != Screen.width || screenHeight != Screen.height) ResizeMap();
    }
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2017-10-02T12:07:58Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=2875#p2875</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: How can I make a 2D map fullscreen?]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=2873#p2873" />
			<content type="html"><![CDATA[<p>Hello, Alex Vertax,<br />Thank you very much for your help with the previous solution! </p><p>Yes, previously I was talking about a 3D map, now it is a 2D map with a GUITexture controller. </p><p>I was going to turn a 3D map into 2D map by disabling the &quot;Allow Camera Control&quot; option in the &quot;Online Maps Tile Control&quot; component. However, in this case, the previous solution You have sent me doesn&#039;t work since it can&#039;t control the camera distance in this case.</p><p>Also, I would appreciate your recommendation on which controller to use for the 2D map among the following (or is there any description of pros/cons for these options).</p><p><a href="https://ibb.co/kneK3w"><span class="postimg"><img src="https://thumb.ibb.co/kneK3w/Screen_Shot_2017_09_30_at_8_49_31_PM.png" alt="https://thumb.ibb.co/kneK3w/Screen_Shot_2017_09_30_at_8_49_31_PM.png" /></span></a> </p><p>Thank you!</p>]]></content>
			<author>
				<name><![CDATA[Rumata]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=537</uri>
			</author>
			<updated>2017-09-30T18:03:04Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=2873#p2873</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: How can I make a 2D map fullscreen?]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=2861#p2861" />
			<content type="html"><![CDATA[<p>Hello.</p><p>Which control do you use?<br />I looked at the history of your messages, and before that you used tileset.<br />For tileset, I have already given you a solution.<br />If you ask again, then you need this for another control.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2017-09-29T23:06:44Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=2861#p2861</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[How can I make a 2D map fullscreen?]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=2853#p2853" />
			<content type="html"><![CDATA[<p>How can I make a 2D map to always take the full screen of the mobile device, regardless the screen orientation? </p><p>Thank you!</p>]]></content>
			<author>
				<name><![CDATA[Rumata]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=537</uri>
			</author>
			<updated>2017-09-28T15:58:13Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=2853#p2853</id>
		</entry>
</feed>
