<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Infinity Code Forum — click and change, color,size,turn off part of the 3d marker]]></title>
	<link rel="self" href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=2006&amp;type=atom" />
	<updated>2022-07-26T11:43:09Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.infinity-code.com/viewtopic.php?id=2006</id>
		<entry>
			<title type="html"><![CDATA[Re: click and change, color,size,turn off part of the 3d marker]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=8472#p8472" />
			<content type="html"><![CDATA[<p>Hello.</p><p>The easiest way is to add MonoBehaviour to the prefab, and use OnMouseUpAsButton.<br />This way you will be able to modify the marker as if it were a simple GameObject.<br /><a href="https://docs.unity3d.com/ScriptReference/MonoBehaviour.OnMouseUpAsButton.html">https://docs.unity3d.com/ScriptReferenc … utton.html</a></p><p>Or you can use marker events, get an instance, and perform the action you want.<br /><a href="https://infinity-code.com/doxygen/online-maps/classOnlineMapsMarkerBase.html#ac8a83bb070667250681a1220bb0744f5">https://infinity-code.com/doxygen/onlin … 20bb0744f5</a><br /><a href="https://infinity-code.com/doxygen/online-maps/classOnlineMapsMarker3D.html#a4bfe702c1cfca471d5cdfc293778120b">https://infinity-code.com/doxygen/onlin … 293778120b</a></p><p>Trying to discuss your code is pretty useless because it depends a lot on the context how and where you use it.<br />But I would recommend not to use GameObject.Find because it is slow and can give you a lot of problems if used incorrectly.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2022-07-26T11:43:09Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=8472#p8472</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[click and change, color,size,turn off part of the 3d marker]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=8470#p8470" />
			<content type="html"><![CDATA[<p>Hello thanks for everything for the previous help, but now I would like to understand how to change the markers 3D during execution, let me explain: I created a marker that contains streets and buildings and is positioned on the map, I have to interact with these elements such as change color to the roads to highlight them when you click on them, or light up other paths present in the same marker or another example simply light up a certain marker in red when clicked</p><p>with my code I can change the color of my prefab present in the scene but the clone object under 3d marker does not change and therefore not even on the map! how can i modify it via code, do i need to recover the clone components? can you give me an example, please</p><br /><p>I wish I could change colors, materials, transformations,turn off and on parts of the 3d Marker</p><p>Thank you very mutch</p><br /><br /><br /><p>for example, here I put the code I use to change the color of the 3d Marker when it is clicked</p><p> [SerializeField] Material[] material;<br />&nbsp; &nbsp; [SerializeField] Renderer rend1;</p><p>&nbsp; &nbsp; void Start()<br />&nbsp; &nbsp; {</p><br /><p>&nbsp; &nbsp; &nbsp; &nbsp; rend1 = GameObject.Find(&quot;Pin1&quot;).GetComponent&lt;Renderer&gt;();<br />&nbsp; &nbsp; &nbsp; &nbsp; rend1.enabled = true;<br />&nbsp; &nbsp; &nbsp; &nbsp; rend1.sharedMaterial = material[0];</p><br /><br /><p> void Update()<br />&nbsp; &nbsp; {</p><p>&nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp; if(Input.touchCount&gt;0 &amp;&amp; Input.touches[0].phase==TouchPhase.Began)</p><p>&nbsp; &nbsp; &nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Ray ray2 = Camera.main.ScreenPointToRay(Input.touches[0].position);</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; RaycastHit hit2;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(Physics.Raycast(ray2,out hit2))</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (hit2.collider.gameObject.tag == &quot;contenuto1&quot;)</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rend1.sharedMaterial = material[1];<br />&nbsp; &nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Debug.Log(&quot;contenut1&quot;);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>]]></content>
			<author>
				<name><![CDATA[simon_me]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2114</uri>
			</author>
			<updated>2022-07-25T17:01:23Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=8470#p8470</id>
		</entry>
</feed>
