<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Infinity Code Forum — Activate / disable buildings]]></title>
	<link rel="self" href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=1280&amp;type=atom" />
	<updated>2019-06-27T23:30:16Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.infinity-code.com/viewtopic.php?id=1280</id>
		<entry>
			<title type="html"><![CDATA[Re: Activate / disable buildings]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=5246#p5246" />
			<content type="html"><![CDATA[<p>I repeated both of your tests several times, and could not reproduce the buildings that appeared.<br />Perhaps the problem requires some additional condition.</p><p>The problem with duplicate Buildings GameObject is fixed.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2019-06-27T23:30:16Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=5246#p5246</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Activate / disable buildings]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=5245#p5245" />
			<content type="html"><![CDATA[<p>I tryed a few things.</p><p>Test A :<br />- the Online Maps Buildings component is enabled before launching app<br />- i launch the app<br />- i disable the Online Maps Buildings component via code directly in a Start() method<br />- later i will enabled the component via code<br />-the buildings appears correctly<br />- i disable the component again<br />- the buildings does disappear<br />- after half a second the buildings are back in the scene. <img src="https://forum.infinity-code.com/img/smilies/sad.png" width="15" height="15" alt="sad" /></p><p>Test B:<br />- the Online Maps Buildings component is disabled before launching app<br />- i launch the app<br />- later i will enabled the component via code<br />-the buildings appears correctly<br />- i disable the component again<br />- the buildings does disappear, and they don&#039;t come back until i enable the component again <img src="https://forum.infinity-code.com/img/smilies/smile.png" width="15" height="15" alt="smile" /></p><p>The reason i was going for test A is that i was trying to enable / disable the component by doing :<br /></p><div class="codebox"><pre><code>public void use_Buildings(bool b)
{
     OnlineMapsBuildings.instance.enabled = b;
}</code></pre></div><p>And this throw an error since the onlineMapsBuildings instance does&#039;nt exist yet if i launch the app without it being enabled.</p><p>using this : <br /></p><div class="codebox"><pre><code>public void use_Buildings(bool b)
{
     OnlineMaps.instance.GetComponent&lt;OnlineMapsBuildings&gt;().enabled = b;
}</code></pre></div><p>Allow me to do &quot;test B&quot; and so my problem is solved.</p><p>Note that in both case, a new gameobject named &quot;buildings&quot; (which become the parent of all the buildins) is created each time i enable the component. </p><p><span class="postimg"><img src="https://i.imgur.com/KzXYUVw.jpg" alt="https://i.imgur.com/KzXYUVw.jpg" /></span></p><p>Hope this feedback is usefull <img src="https://forum.infinity-code.com/img/smilies/wink.png" width="15" height="15" alt="wink" /></p>]]></content>
			<author>
				<name><![CDATA[Thibault]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=821</uri>
			</author>
			<updated>2019-06-27T18:57:58Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=5245#p5245</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Activate / disable buildings]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=5243#p5243" />
			<content type="html"><![CDATA[<p>Hello.</p><p>To disable buildings, you just need to disable Online Maps Buildings component.<br />I just checked it and it works correctly.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2019-06-27T18:04:43Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=5243#p5243</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Activate / disable buildings]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=5242#p5242" />
			<content type="html"><![CDATA[<p>Hi<br />I started to use the OnlineMapsBuildings component.</p><p>What i want to achieve is basically being able to activate / disable the buildings at runtime.</p><p>I tried to disable the OnlineMapsBuildings script of the map but it does&#039;nt get rid of the buildings.</p><p>i tryed to delete manually the buildings with <br /></p><div class="codebox"><pre><code>foreach (OnlineMapsBuildingBase item in OnlineMapsBuildings.instance.buildings.Values)
{
      Destroy(item.gameObject);
}</code></pre></div><p>But they keep coming back ! </p><p>Is there a way to achieve this ?</p>]]></content>
			<author>
				<name><![CDATA[Thibault]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=821</uri>
			</author>
			<updated>2019-06-27T15:48:55Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=5242#p5242</id>
		</entry>
</feed>
