<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Infinity Code Forum — How to update a DrawingElement]]></title>
	<link rel="self" href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=454&amp;type=atom" />
	<updated>2017-03-30T12:15:42Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.infinity-code.com/viewtopic.php?id=454</id>
		<entry>
			<title type="html"><![CDATA[Re: How to update a DrawingElement]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=2126#p2126" />
			<content type="html"><![CDATA[<p>We replaced fields to properties, and now Redraw is invoked automatically.</p><p>Redraw just marks that map must be redrawed. <br />Drawing occurs a little bit later and once (no matter how many times you invoke Redraw).</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2017-03-30T12:15:42Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=2126#p2126</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: How to update a DrawingElement]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=2123#p2123" />
			<content type="html"><![CDATA[<p>Okay gotcha. Didn&#039;t realize we would have to explicitly call OnlineMaps.instance.Redraw(). That works. </p><p>I see there is an OnlineMaps.instance.needRedraw. Maybe this could be set in a color property when the color is set. I am assuming the &quot;needRedraw&quot; flag will tell the map to redraw at some point, but will only happen when it gets to that point? So a lot of color changes could happen, and only one redraw would have to happen?</p>]]></content>
			<author>
				<name><![CDATA[bp10719]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=289</uri>
			</author>
			<updated>2017-03-29T16:38:31Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=2123#p2123</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: How to update a DrawingElement]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=2116#p2116" />
			<content type="html"><![CDATA[<p>Hello.</p><p>Test script (works well on my side):<br /></p><div class="codebox"><pre><code>using UnityEngine;

public class TestRectBackground:MonoBehaviour
{
    private OnlineMapsDrawingRect rect;

    private void OnGUI()
    {
        if (GUILayout.Button(&quot;Randomize background color&quot;))
        {
            rect.backgroundColor = new Color(Random.Range(0f, 1f), Random.Range(0f, 1f), Random.Range(0f, 1f));
            OnlineMaps.instance.Redraw();
        }
        if (GUILayout.Button(&quot;Randomize border color&quot;))
        {
            rect.borderColor = new Color(Random.Range(0f, 1f), Random.Range(0f, 1f), Random.Range(0f, 1f));
            OnlineMaps.instance.Redraw();
        }
    }

    private void Start()
    {
        rect = new OnlineMapsDrawingRect(0, 0, 1, 1, Color.black, 3, Color.red);
        OnlineMaps.instance.AddDrawingElement(rect);
    }
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2017-03-28T22:25:53Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=2116#p2116</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: How to update a DrawingElement]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=2115#p2115" />
			<content type="html"><![CDATA[<p>Hi there,</p><p>We have updated to the newest version, but this issue persists. The DrawingRect&#039;s color does not get changed immediately after setting it. It appears some kind of event has to occur before OnlineMaps will update or something like that. If we set the background color of a DrawingRect for example, we won&#039;t see it change until the map is clicked. For now, to get past this, when we update the color we do:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; OnlineMaps.instance.RemoveDrawingElement(drawingRect, false);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; OnlineMaps.instance.AddDrawingElement(drawingRect);</p>]]></content>
			<author>
				<name><![CDATA[bp10719]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=289</uri>
			</author>
			<updated>2017-03-28T22:19:09Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=2115#p2115</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: How to update a DrawingElement]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=1957#p1957" />
			<content type="html"><![CDATA[<p>Gotcha. Thanks!</p>]]></content>
			<author>
				<name><![CDATA[bp10719]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=289</uri>
			</author>
			<updated>2017-03-09T22:55:06Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=1957#p1957</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: How to update a DrawingElement]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=1956#p1956" />
			<content type="html"><![CDATA[<p>Hello.</p><p>This is a bug in Online Maps.<br />Fixed. In the next version this will work correctly.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2017-03-09T22:51:15Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=1956#p1956</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[How to update a DrawingElement]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=1955#p1955" />
			<content type="html"><![CDATA[<p>I am trying to figure out how to update a drawing element after it is created.</p><p>I can create a drawingElement and save a reference to it, and update its properties, but the changes are not displayed on the map after it is initially added.</p><p>Is there any way to update a drawing element that has been added to the map after it is created? And be able to show those changes?</p><p>For example, I want to change the background color of an OnlineMapsDrawingRect. </p><p>Thanks!</p>]]></content>
			<author>
				<name><![CDATA[bp10719]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=289</uri>
			</author>
			<updated>2017-03-09T22:39:38Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=1955#p1955</id>
		</entry>
</feed>
