<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Crash accessing textureCoord2 on scene layer RaycastHit in ArcGIS Maps SDK for Unity Questions</title>
    <link>https://community.esri.com/t5/arcgis-maps-sdk-for-unity-questions/crash-accessing-texturecoord2-on-scene-layer/m-p/1560164#M1021</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm encountering a crash when using Unity's `RaycastHit.textureCoord2` property exclusively when raycasting against scene layers.&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;RaycastHit hit;
if (Physics.Raycast(rayOrigin, rayDirection, out hit))
{
    var texCoord2 = hit.textureCoord2; // Crash in textureCoord2 access
}&lt;/LI-CODE&gt;&lt;P&gt;Does anyone have experience with this issue and have any suggestions on how to avoid a crash while still being able to raycast against scene layers and access `textureCoord2` (in case the hit is not an ArcGIS scene layer and I do need to use `RaycastHit.textureCoord2` for other potential hits)?&lt;/P&gt;&lt;P&gt;Note: I suspect this could be related to the fact that scene layer meshes have feature indices in uv channel 1, which consist of a single float value rather than a `Vector2`.&lt;/P&gt;&lt;P&gt;Example excerpt of Unity editor logs showing crash details:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;=================================================================
	Native Crash Reporting
=================================================================
Got a UNKNOWN while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================

=================================================================
	Managed Stacktrace:
=================================================================
	  at &amp;lt;unknown&amp;gt; &amp;lt;0xffffffff&amp;gt;
	  at UnityEngine.RaycastHit:CalculateRaycastTexCoord_Injected &amp;lt;0x0013e&amp;gt;
	  at UnityEngine.RaycastHit:CalculateRaycastTexCoord &amp;lt;0x000b2&amp;gt;
	  at UnityEngine.RaycastHit:get_textureCoord2 &amp;lt;0x0012a&amp;gt;
	  at Raycaster:Update &amp;lt;0x003b2&amp;gt;
	  at System.Object:runtime_invoke_void__this__ &amp;lt;0x00187&amp;gt;
=================================================================
Received signal SIGSEGV&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Unity version: 2022.3.52f&lt;/P&gt;</description>
    <pubDate>Tue, 19 Nov 2024 12:41:10 GMT</pubDate>
    <dc:creator>Thomas-F</dc:creator>
    <dc:date>2024-11-19T12:41:10Z</dc:date>
    <item>
      <title>Crash accessing textureCoord2 on scene layer RaycastHit</title>
      <link>https://community.esri.com/t5/arcgis-maps-sdk-for-unity-questions/crash-accessing-texturecoord2-on-scene-layer/m-p/1560164#M1021</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm encountering a crash when using Unity's `RaycastHit.textureCoord2` property exclusively when raycasting against scene layers.&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;RaycastHit hit;
if (Physics.Raycast(rayOrigin, rayDirection, out hit))
{
    var texCoord2 = hit.textureCoord2; // Crash in textureCoord2 access
}&lt;/LI-CODE&gt;&lt;P&gt;Does anyone have experience with this issue and have any suggestions on how to avoid a crash while still being able to raycast against scene layers and access `textureCoord2` (in case the hit is not an ArcGIS scene layer and I do need to use `RaycastHit.textureCoord2` for other potential hits)?&lt;/P&gt;&lt;P&gt;Note: I suspect this could be related to the fact that scene layer meshes have feature indices in uv channel 1, which consist of a single float value rather than a `Vector2`.&lt;/P&gt;&lt;P&gt;Example excerpt of Unity editor logs showing crash details:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;=================================================================
	Native Crash Reporting
=================================================================
Got a UNKNOWN while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================

=================================================================
	Managed Stacktrace:
=================================================================
	  at &amp;lt;unknown&amp;gt; &amp;lt;0xffffffff&amp;gt;
	  at UnityEngine.RaycastHit:CalculateRaycastTexCoord_Injected &amp;lt;0x0013e&amp;gt;
	  at UnityEngine.RaycastHit:CalculateRaycastTexCoord &amp;lt;0x000b2&amp;gt;
	  at UnityEngine.RaycastHit:get_textureCoord2 &amp;lt;0x0012a&amp;gt;
	  at Raycaster:Update &amp;lt;0x003b2&amp;gt;
	  at System.Object:runtime_invoke_void__this__ &amp;lt;0x00187&amp;gt;
=================================================================
Received signal SIGSEGV&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Unity version: 2022.3.52f&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2024 12:41:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-maps-sdk-for-unity-questions/crash-accessing-texturecoord2-on-scene-layer/m-p/1560164#M1021</guid>
      <dc:creator>Thomas-F</dc:creator>
      <dc:date>2024-11-19T12:41:10Z</dc:date>
    </item>
  </channel>
</rss>

