<?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 — Maps huge memory usage]]></title>
		<link>https://forum.infinity-code.com/viewtopic.php?id=1506</link>
		<atom:link href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=1506&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Maps huge memory usage.]]></description>
		<lastBuildDate>Tue, 02 Apr 2024 15:19:48 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Maps huge memory usage]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=9479#p9479</link>
			<description><![CDATA[<p>Thank you for the answers!<br />1. I just mean that there is a probability of infinite memory growth right out of the box (when memory cache is enabled).<br />2. tileManager.UnloadUnusedTiles() actually helped. Thanks!</p>]]></description>
			<author><![CDATA[null@example.com (denis)]]></author>
			<pubDate>Tue, 02 Apr 2024 15:19:48 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=9479#p9479</guid>
		</item>
		<item>
			<title><![CDATA[Re: Maps huge memory usage]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=9478#p9478</link>
			<description><![CDATA[<p>Hi.</p><p>1. This difference happens because the cache counts the size of the average tile image (png, ~30 kb), but not its texture in memory (~1 mb for uncompressed, ~131 kb for compressed).<br />I realise this is not entirely logical, but unfortunately it&#039;s too late to change this, because this change will affect existing user projects.<br />I&#039;ll think about how to describe it so it doesn&#039;t confuse users.</p><p>The way with increasing the constant and setting the appropriate cache size works well. <br />But, the thing to keep in mind here is that the profiler also shows the editor textures. <br />In my case, this increases the displayed value by almost 100 mb.</p><p>2. This is because using tileManager.Reset() only marks tiles unused. <br />In a normal usage scenario, the tiles are destroyed later.<br />Because you have disabled the map GameObject, its LateUpdate is no longer called, and there is no destruction of tiles until you enable the map again.<br />To work around this after Reset() call tileManager.UnloadUnusedTiles().</p>]]></description>
			<author><![CDATA[null@example.com (Alex Vertax)]]></author>
			<pubDate>Mon, 01 Apr 2024 22:47:32 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=9478#p9478</guid>
		</item>
		<item>
			<title><![CDATA[Re: Maps huge memory usage]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=9477#p9477</link>
			<description><![CDATA[<p>Hi! <br />1. I have the same problem in my case:<br />Tileset control is used.<br />512 x 512 tiles are used, texture compression is disabled. </p><p>At the moment the memory cache decided it filled 10 MB Unity profiler shows growth of about 600 MB in textures. <br />What i&#039;ve tried (did not help):<br />- set memory caches size to 1 / 50 / 150 / 200 MB;<br />- temporary change the size constant in MemoryCacheItem from 30 000 to 1 000 000;<br />- set Online Maps : Advanced : Count Parent Levels from 5 to 0. </p><p>Also the problem is reproducible in an empty project:<br />- create an empty Unity project;<br />- call GameObject -&gt; Infinity Code -&gt; Online Maps -&gt; Map Wizard;<br />- check Move camera to Map, press Fix camera near, far. <br />- chose OpenStreetMap:Mapnik;<br />- press Create;<br />- play in Unity editor and start continuously zooming in and out while watching the Unity profiler : Memory : Textures. <br />It starts from 100 MB, grows to 200 MB and drops to 170 MB on memory cache clearing. But suddenly starts to grow indefinitely (was able to get to 500+ MB).<br />The same bug is also reproducible in case of default (in wizard) map provider ArcGIS (Esri):WorldImagery but requires to zoom longer. </p><p>2. Connected question about memory:<br />Disabling the map GameObject while zoom == 1 leaves the map on the minimum level of textures memory consumption. But it is not the case if disabling while zoomed in.<br />I&#039;m setting zoom = 1 on the next map GameObject activation. And it resets memory to the minimum level. But setting zoom == 1 in OnDisable() does not free memory. <br />I would like to leave the map on the minimum memory level in every case when I do not need the map and disable the map GameObject. <br />What i&#039;ve tried to call in OnDisable() (did not help):<br />- set zoom = 1;<br />- call OnlineMapsCache.ClearMemoryCache();<br />- call OnlineMaps.tileManager.Reset();<br />Also tried to destroy and recreate the map GameObject from prefab (instead of disabling) every time I need it. But it increases textures memory for about 2 MB on every creation.</p>]]></description>
			<author><![CDATA[null@example.com (denis)]]></author>
			<pubDate>Mon, 01 Apr 2024 07:04:25 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=9477#p9477</guid>
		</item>
		<item>
			<title><![CDATA[Re: Maps huge memory usage]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=6204#p6204</link>
			<description><![CDATA[<p>Yeah, thought the same, was just curious about it! Thank you for all the responses!</p>]]></description>
			<author><![CDATA[null@example.com (jhcom)]]></author>
			<pubDate>Sat, 02 May 2020 18:28:28 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=6204#p6204</guid>
		</item>
		<item>
			<title><![CDATA[Re: Maps huge memory usage]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=6203#p6203</link>
			<description><![CDATA[<p>Thanks for the video, it is very useful.<br />But, unfortunately, this is not particularly applicable here, because in addition to zoom, you need to keep in mind:<br />- jump through 180 meridian;<br />- changing the position and / or size of the map in the scene;<br />- changing the position of the camera (for example, when you rotate or tilt the camera using Camera Orbit);<br />- updating elevation data.</p><p>This can be implemented in specific projects when you know for sure that these situations will never happen in your case.<br />But to make a general example that will use these optimizations is not possible, because immediately there is someone who will say that this does not work for him because of something.</p>]]></description>
			<author><![CDATA[null@example.com (Alex Vertax)]]></author>
			<pubDate>Sat, 02 May 2020 14:44:40 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=6203#p6203</guid>
		</item>
		<item>
			<title><![CDATA[Re: Maps huge memory usage]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=6202#p6202</link>
			<description><![CDATA[<p>Ah the memory usage on xcode only went up as I was scrolling through the map, it&#039;s reproducible on an empty project with just maps v3 implemented. </p><p>Basically as you navigate the map, all map points need ui updates. Let&#039;s say you have a marker gameobject with a rect transform and an image inside of it. That&#039;s 2 rect transforms total. This means that as you navigate the map, all markers need a transform update times 2. If you have 100 objects in the map, you need 200 transform updates. It&#039;s just how the unity ui works. I don&#039;t think it&#039;s possible to fix this though. This guy from unity explains it much better than me: <br /><a href="https://www.youtube.com/watch?v=_wxitgdx-UI&amp;t=1558s">https://www.youtube.com/watch?v=_wxitgdx-UI&amp;t=1558s</a></p><p>I was just curious if there was a method to not have all the points getting dirty and updating themselves as you scroll the map, but I don&#039;t think it&#039;s possible. The only method I can think of is to keep the map in a bigger size and move a scroll rect above it instead of the map itself, but then you can&#039;t zoom in. Like this you can put 1000 points and scroll with no spikes, but no zooming.&nbsp; </p><p>Thank you so much for answering my questions and helping me out! Have a great day.</p><p>Julian</p>]]></description>
			<author><![CDATA[null@example.com (jhcom)]]></author>
			<pubDate>Sat, 02 May 2020 07:03:24 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=6202#p6202</guid>
		</item>
		<item>
			<title><![CDATA[Re: Maps huge memory usage]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=6201#p6201</link>
			<description><![CDATA[<p>Xcode shows you the overall memory usage of an application that also includes Unity Engine itself and your assets.<br />So here to say that the map uses 500 megabytes - this is not correct.</p><p>Tileset may be different. <br />Set the camera perpendicular to the map and it will look like a 2D map.<br />Or you can use Render Texture to display the map on UI.<br />Online Maps v3.8 will have an example for this.</p><p>Unfortunately, I did not understand your questions about custom markers.<br />Please rephrase this.</p>]]></description>
			<author><![CDATA[null@example.com (Alex Vertax)]]></author>
			<pubDate>Fri, 01 May 2020 20:17:34 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=6201#p6201</guid>
		</item>
		<item>
			<title><![CDATA[Re: Maps huge memory usage]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=6200#p6200</link>
			<description><![CDATA[<p>Managed to switch it to 3D, worked much better with loading and memory! Still quite a lot, but I can tweak that. I do have a question though. Why are the points transforms updating when using the custom marker example script? If I load 100 points all these transforms have to be updated at the same time for each layer of the prefab as I scroll. Is this the only way how this can be implemented?</p>]]></description>
			<author><![CDATA[null@example.com (jhcom)]]></author>
			<pubDate>Fri, 01 May 2020 15:39:23 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=6200#p6200</guid>
		</item>
		<item>
			<title><![CDATA[Re: Maps huge memory usage]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=6199#p6199</link>
			<description><![CDATA[<p>Hey Alex,</p><p>Thank you for the quick response! I have a 2D game, so I thought I would use it in 2D, tileset was only in 3D available. I&#039;ll try to convert it to tileset/3D. The map is only part of the game, so I need it to be loaded on a tab and also start the load there.</p><p>I found it with an xcode Build/Run when I kept scrolling ons the map, I saw in xcode that memory kept increasing and never dropped down.</p><p>Kind regards,</p><p>Julian</p>]]></description>
			<author><![CDATA[null@example.com (jhcom)]]></author>
			<pubDate>Fri, 01 May 2020 08:11:25 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=6199#p6199</guid>
		</item>
		<item>
			<title><![CDATA[Re: Maps huge memory usage]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=6198#p6198</link>
			<description><![CDATA[<p>Hello.</p><p>1. In 99% of cases, you must use tileset control.<br />Tileset has much better performance, uses less memory, and has many exclusive features.<br />In your screenshot, I do not see anything that forces you not to use tileset.<br />2. A map on texture of 512x512 cannot use 500 megabytes.<br />This is too much, even for 2048x2048.<br />How did you find this value?<br />3. To make the map automatically center on the screen, use Tileset + Camera Orbit.<br />4. To adjust the size of the map to fit the screen, use Adjust to Screen.</p>]]></description>
			<author><![CDATA[null@example.com (Alex Vertax)]]></author>
			<pubDate>Thu, 30 Apr 2020 18:32:25 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=6198#p6198</guid>
		</item>
		<item>
			<title><![CDATA[Maps huge memory usage]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=6197#p6197</link>
			<description><![CDATA[<p>Hey, maybe I am doing something wrong, but the maps seems really unclear for me. </p><p>When zooming, memory usage keeps increasing and doesn&#039;t decrease. Street names are clear on load, bu on moving or zooming they become blurry as you can see in the attached photo. </p><p>I read on a different post that increasing cache size helps, so I did that, but to no prevail. My current settings are:</p><p>google maps, terrain<br />I tried create texture at 2048x2048, now I put it back to 512x512.<br />With memory cache on, memory keeps increasing on scrolling till the device is out of memory<br />Dache mb = 120, unload 30<br />Memory cache 60, unload 30<br />API key put in<br />Total of 5 custom markers which consist out of a few images and no update methods</p><p>If I remove memory cache, then it remains around 501mb total, but the streets are still very unclear. I am using unity 2020.1</p><p>Do you have some recommendation for settings?</p><p>Kind regards,</p><p>Julian</p>]]></description>
			<author><![CDATA[null@example.com (jhcom)]]></author>
			<pubDate>Thu, 30 Apr 2020 15:58:34 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=6197#p6197</guid>
		</item>
	</channel>
</rss>
