<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Infinity Code Forum — Acitivate/ disactivate Buildings]]></title>
	<link rel="self" href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=593&amp;type=atom" />
	<updated>2017-07-18T15:48:42Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.infinity-code.com/viewtopic.php?id=593</id>
		<entry>
			<title type="html"><![CDATA[Re: Acitivate/ disactivate Buildings]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=2621#p2621" />
			<content type="html"><![CDATA[<p>Hello.</p><p>The example for version 2.5.12 or older is above.<br />Please explain in detail what exactly does not work well, and how you expected it to work.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2017-07-18T15:48:42Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=2621#p2621</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Acitivate/ disactivate Buildings]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=2618#p2618" />
			<content type="html"><![CDATA[<p>Hi,</p><p>I try to implement this function to activate/deactivate the buildings, But it&#039;s not working very well and it take much time to be executed.<br />I saw that you have released a new version of the plugin with the ability of activating/deactivating the buildings, but I am stick with the version 2.5.12.1 and can not update to the next version.</p><p>Is there a possibility or exemple for this version to activate/deactivate buildings with a clean process?</p><p>Thanks in advance</p>]]></content>
			<author>
				<name><![CDATA[trouk]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=326</uri>
			</author>
			<updated>2017-07-18T13:43:10Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=2618#p2618</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Acitivate/ disactivate Buildings]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=2583#p2583" />
			<content type="html"><![CDATA[<p>Hello.</p><p>Unfortunately, the current version of Online Maps does not have a good way to deactivate buildings.<br />Currently you can use this way:<br /></p><div class="codebox"><pre><code>using System.Reflection;
using UnityEngine;

public class DeactivateBuildings:MonoBehaviour
{
    private bool activated = true;

    private void OnGUI()
    {
        if (GUILayout.Button(activated ? &quot;Deactivate&quot; : &quot;Activate&quot;))
        {
            activated = !activated;
            if (activated)
            {
                OnlineMapsBuildings.instance.enabled = true;

                FieldInfo fTopLeft = typeof(OnlineMapsBuildings).GetField(&quot;topLeft&quot;, BindingFlags.Instance | BindingFlags.NonPublic);
                FieldInfo fBottomRight = typeof(OnlineMapsBuildings).GetField(&quot;bottomRight&quot;, BindingFlags.Instance | BindingFlags.NonPublic);
                fTopLeft.SetValue(OnlineMapsBuildings.instance, new OnlineMapsVector2i());
                fBottomRight.SetValue(OnlineMapsBuildings.instance, new OnlineMapsVector2i());
            }
            else
            {
                MethodInfo method = typeof(OnlineMapsBuildings).GetMethod(&quot;RemoveAllBuildings&quot;, BindingFlags.Instance | BindingFlags.NonPublic);
                method.Invoke(OnlineMapsBuildings.instance, null);
                OnlineMapsBuildings.instance.enabled = false;
            }
        }
    }
}</code></pre></div><p>Yes, it&#039;s a dirty hack.<br />We will add the ability to correctly activate and deactivate buildings in the next version.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2017-07-08T18:58:00Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=2583#p2583</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Acitivate/ disactivate Buildings]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=2580#p2580" />
			<content type="html"><![CDATA[<p>Hi,</p><p>How can I activate desactivate buildings in Runtime With a switch button ?</p>]]></content>
			<author>
				<name><![CDATA[trouk]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=326</uri>
			</author>
			<updated>2017-07-07T13:23:02Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=2580#p2580</id>
		</entry>
</feed>
