<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Infinity Code Forum — using UGUI and tileset map]]></title>
		<link>https://forum.infinity-code.com/viewtopic.php?id=600</link>
		<atom:link href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=600&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in using UGUI and tileset map.]]></description>
		<lastBuildDate>Thu, 24 Aug 2017 23:12:31 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: using UGUI and tileset map]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=2730#p2730</link>
			<description><![CDATA[<p>Hello.</p><p>Please send your scene (as a package) to support (support@infinity-code.com).<br />I will check what happens with your marker, and I&#039;ll give you recommendations on how to fix the problem.<br />To make it clear:<br />I do not need your working project. I need any project where I can see this problem.</p><p>Lines with textures support only tileset.<br />But this does not mean that you can not make a line with the texture for uGUI.<br />You need to implement your own Drawing API, which will draw the lines.<br />This depends only on your programming skill.</p>]]></description>
			<author><![CDATA[null@example.com (Alex Vertax)]]></author>
			<pubDate>Thu, 24 Aug 2017 23:12:31 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=2730#p2730</guid>
		</item>
		<item>
			<title><![CDATA[Re: using UGUI and tileset map]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=2721#p2721</link>
			<description><![CDATA[<p>Sorry for long none response..<br />I had questioned about mixing UGUI and Tileset-OnlineMaps. <br />well temporally i fixed issue myself. (Not well)<br />The result is this, attached image.<br />I changed &lt;Canvas mode&gt; to &#039;Screen Space Camera&#039; and add &lt;Canvas Group&gt; to use &#039;Blocks Raycasts&#039; and &#039;Ignore Parent Groups&#039; to click UGUI Button when the Map active.<br />Everything is fine but the problem recently found...<br />I added custom marker on Map. When Map go Up and Down marker still active when Map didn&#039;t show marker&#039;s coordinate. </p><p>The situation is on Image. (On Map Bottom, there is flag image (marker). If I Change Marker Align Top or Bottom still this problem exist top or bottom side)<br />Anyway to help this problem?</p><p>You had suggested some custom line style solution. <br />Is only works when Tileset Map?? I added this code UIImageControl Map, but not work. (That UIImageControl Map do not have<br />Marker problem, but could not change Line Texture...<br />If possible to change line texture in UIImageControl Map, I would change TileSet Map to UIImageControl Map.</p><p>I hope you could give me any help, any advice.</p><div class="quotebox"><cite>Alex Vertax wrote:</cite><blockquote><p>You can work around this in this way:<br /></p><div class="codebox"><pre><code>using System.Collections.Generic;
using System.Reflection;
using UnityEngine;

public class DrawLineWithTexture:MonoBehaviour
{
    public Texture2D lineTexture;
    private OnlineMapsMarker marker1;
    private OnlineMapsMarker marker2;
    private OnlineMapsDrawingLine line;

    private void Start()
    {
        OnlineMapsControlBase.instance.OnMapClick += OnMapClick;
    }

    private void OnMapClick()
    {
        OnlineMapsMarker marker = OnlineMaps.instance.AddMarker(OnlineMapsControlBase.instance.GetCoords());

        if (marker1 == null)
        {
            marker1 = marker;
            return;
        }

        marker2 = marker;
        List&lt;Vector2&gt; points = new List&lt;Vector2&gt;
        {
            marker1.position,
            marker2.position
        };
        line = new OnlineMapsDrawingLine(points, Color.red, 10);
        line.texture = lineTexture;
        OnlineMaps.instance.AddDrawingElement(line);
        OnlineMaps.instance.OnMapUpdated += OnMapUpdated; // Delay because the line is not yet drawn.

        marker1.OnDrag += OnMarkerDrag;
        marker2.OnDrag += OnMarkerDrag;
        OnlineMapsControlBase.instance.OnMapClick -= OnMapClick;
    }

    private void OnMapUpdated()
    {
        UpdateUVScale();
        OnlineMaps.instance.OnMapUpdated -= OnMapUpdated;
    }

    private void OnMarkerDrag(OnlineMapsMarkerBase marker)
    {
        List&lt;Vector2&gt; points = new List&lt;Vector2&gt;
        {
            marker1.position,
            marker2.position
        };
        line.points = points;

        UpdateUVScale();

        OnlineMaps.instance.Redraw();
    }

    private void UpdateUVScale()
    {
        FieldInfo field = line.GetType().GetField(&quot;gameObject&quot;, BindingFlags.NonPublic | BindingFlags.Instance);
        if (field == null)
        {
            Debug.Log(&quot;No field&quot;);
            return;
        }
        GameObject lineGO = field.GetValue(line) as GameObject;

        MeshFilter meshFilter = lineGO.GetComponent&lt;MeshFilter&gt;();
        Vector3[] vertices = meshFilter.sharedMesh.vertices;

        float distance = 0;

        for (int i = 2; i &lt; vertices.Length; i += 2) distance += (vertices[i - 2] - vertices[i]).magnitude;

        distance /= line.width * 2;

        MeshRenderer meshRenderer = lineGO.GetComponent&lt;MeshRenderer&gt;();
        meshRenderer.sharedMaterials[0].mainTextureScale = new Vector2(1, distance);
    }
}</code></pre></div><p>Yes, this is a bad practice and a dirty hack, but I do not know how to do this without access to the vertices.<br />Theoretically, we can make gameObject field public.</p></blockquote></div>]]></description>
			<author><![CDATA[null@example.com (joonyboy)]]></author>
			<pubDate>Wed, 23 Aug 2017 02:10:22 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=2721#p2721</guid>
		</item>
		<item>
			<title><![CDATA[Re: using UGUI and tileset map]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=2603#p2603</link>
			<description><![CDATA[<p>Hello.</p><p>Please explain in detail what you want to do.<br />I will try to explain how to do this.</p><p>The current formulation of your question can have many answers, and all answers are correct for one case and incorrect for another.</p><p>P.S. Your post does not contain an image.</p>]]></description>
			<author><![CDATA[null@example.com (Alex Vertax)]]></author>
			<pubDate>Mon, 17 Jul 2017 02:26:30 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=2603#p2603</guid>
		</item>
		<item>
			<title><![CDATA[using UGUI and tileset map]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=2602#p2602</link>
			<description><![CDATA[<p>Few month ago, I questioned about line styling and you replied using tileset to change texture.</p><p>That day I used NGUI, but know some reason, I changed it to UGUI.</p><p>anyway problem is, I don&#039;t know how to set clickable both UGUI button and onlinemaps</p><p>I attached capture image</p><p>Tileset need camera so I created subcamera and set UGUI canvas render mode to screen space camera</p><p>I know maybe it is unity issue, not online maps. I tried googling and any try but i need your help <img src="https://forum.infinity-code.com/img/smilies/sad.png" width="15" height="15" alt="sad" /></p>]]></description>
			<author><![CDATA[null@example.com (joonyboy)]]></author>
			<pubDate>Mon, 17 Jul 2017 01:43:35 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=2602#p2602</guid>
		</item>
	</channel>
</rss>
