<?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 Re: I want to retrieve and display 3d attribute data using Feature ID as a key in ArcGIS Maps SDK for Unity Questions</title>
    <link>https://community.esri.com/t5/arcgis-maps-sdk-for-unity-questions/i-want-to-retrieve-and-display-3d-attribute-data/m-p/1255586#M426</link>
    <description>&lt;P&gt;Same question here, also the float value extraction, appreciated if some one can help &lt;span class="lia-unicode-emoji" title=":folded_hands:"&gt;🙏&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Editted on 7 Feb 23:&lt;/P&gt;&lt;P&gt;I found the data stored in 8 byte, this works for float... may be int as well&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;var buffer = attribute.Data;
var unsafePtr = NativeArrayUnsafeUtility.GetUnsafePtr(buffer);
var metadata = (double*)unsafePtr;
var count = attribute.Data.Length / 8;

for (var i = 0; i &amp;lt; count; ++i)
{
    predicate((float)metadata[i], i);
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 07 Feb 2023 06:45:22 GMT</pubDate>
    <dc:creator>dun82</dc:creator>
    <dc:date>2023-02-07T06:45:22Z</dc:date>
    <item>
      <title>I want to retrieve and display 3d attribute data using Feature ID as a key</title>
      <link>https://community.esri.com/t5/arcgis-maps-sdk-for-unity-questions/i-want-to-retrieve-and-display-3d-attribute-data/m-p/1242220#M386</link>
      <description>&lt;P&gt;I would like to retrieve and display 3d attribute data using the Feature ID obtained from the ArcGISHitTestSample scene as a key.&lt;BR /&gt;&lt;BR /&gt;In the Sample3DAttributesComponent class of the 3DAttributesSample scene, the material is changed when "AttributeType:BuildingName" matches a unique name.&lt;BR /&gt;&lt;BR /&gt;I thought that if this matched the Feature ID obtained in the aforementioned hit test, the corresponding building would be considered to have been identified and the 3D attribute data (year of construction, building name, etc.) could be retrieved and displayed.&lt;BR /&gt;However, this does not work.&lt;/P&gt;&lt;P&gt;Is this possible?&lt;BR /&gt;Or is this a misguided attempt?&lt;/P&gt;&lt;P&gt;Code is here:Sample3DAttributesComponent.cs&lt;BR /&gt;(I first tried to debug output of the FID.&lt;BR /&gt;I can output it, but it seems to be different from the value output in the HitTestSample scene.)&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;    private void Setup3DAttributes(ArcGIS3DObjectSceneLayer buildingLayer)
    {
        if (buildingLayer == null)
        {
            return;
        }

        if (layerAttribute == AttributeType.ConstructionYear)
        {
            Setup3DAttributesFloatAndIntegerType(buildingLayer);
        }
        else if (layerAttribute == AttributeType.BuildingName)
        {
            Setup3DAttributesOtherType(buildingLayer);
        }

        // Add a process to handle FIDs
        else if (layerAttribute == AttributeType.FID)
        {
            var layerAttributes = ArcGISImmutableArray&amp;lt;String&amp;gt;.CreateBuilder();
            layerAttributes.Add("FID");

            var renderAttributeDescriptions = ArcGISImmutableArray&amp;lt;Esri.GameEngine.Attributes.ArcGISVisualizationAttributeDescription&amp;gt;.CreateBuilder();
            renderAttributeDescriptions.Add(new Esri.GameEngine.Attributes.ArcGISVisualizationAttributeDescription("IsBuildingOfInterest", Esri.GameEngine.Attributes.ArcGISVisualizationAttributeType.Float32));

            attributeProcessor = new Esri.GameEngine.Attributes.ArcGISAttributeProcessor();

            attributeProcessor.ProcessEvent += (ArcGISImmutableArray&amp;lt;Esri.GameEngine.Attributes.ArcGISAttribute&amp;gt; layerNodeAttributes, ArcGISImmutableArray&amp;lt;Esri.GameEngine.Attributes.ArcGISVisualizationAttribute&amp;gt; renderNodeAttributes) =&amp;gt;
            {
                var fidAttribute = layerNodeAttributes.At(0);
                var isBuildingOfInterestAttribute = renderNodeAttributes.At(0);
                var isBuildingOfInterestBuffer = isBuildingOfInterestAttribute.Data;
                var isBuildingOfInterestData = isBuildingOfInterestBuffer.Reinterpret&amp;lt;float&amp;gt;(sizeof(byte));

                // FID Debug Output
                ForEachInt64(fidAttribute, (long element, Int32 index) =&amp;gt;
                {
                    Debug.Log("FID::" + element);
                });
            };

            buildingLayer.SetAttributesToVisualize(layerAttributes.MoveToArray(), renderAttributeDescriptions.MoveToArray(), attributeProcessor);
        }
    }

    // Add function
    void ForEachInt64(Esri.GameEngine.Attributes.ArcGISAttribute attribute, Action&amp;lt;Int64, Int32&amp;gt; predicate)
    {
        unsafe
        {
            var buffer = attribute.Data;
            var unsafePtr = NativeArrayUnsafeUtility.GetUnsafePtr(buffer);
            var metadata = (int*)unsafePtr;
            var count = metadata[0];

            IntPtr intPtr = (IntPtr)unsafePtr + sizeof(int);

            for (var i = 0; i &amp;lt; count; ++i)
            {
                Int64 element = *((Int64*)intPtr); // Rises NullReferenceException: Object reference not set to an instance of an object

                predicate(element, i);

                intPtr += sizeof(Int64);
            }
        }
    }&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;runtime console:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hiroyuki_s_0-1671339146788.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/58822i839E0B66DBB4FE2C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hiroyuki_s_0-1671339146788.png" alt="hiroyuki_s_0-1671339146788.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Dec 2022 04:57:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-maps-sdk-for-unity-questions/i-want-to-retrieve-and-display-3d-attribute-data/m-p/1242220#M386</guid>
      <dc:creator>hiroyuki_s</dc:creator>
      <dc:date>2022-12-18T04:57:44Z</dc:date>
    </item>
    <item>
      <title>Re: I want to retrieve and display 3d attribute data using Feature ID as a key</title>
      <link>https://community.esri.com/t5/arcgis-maps-sdk-for-unity-questions/i-want-to-retrieve-and-display-3d-attribute-data/m-p/1255586#M426</link>
      <description>&lt;P&gt;Same question here, also the float value extraction, appreciated if some one can help &lt;span class="lia-unicode-emoji" title=":folded_hands:"&gt;🙏&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Editted on 7 Feb 23:&lt;/P&gt;&lt;P&gt;I found the data stored in 8 byte, this works for float... may be int as well&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;var buffer = attribute.Data;
var unsafePtr = NativeArrayUnsafeUtility.GetUnsafePtr(buffer);
var metadata = (double*)unsafePtr;
var count = attribute.Data.Length / 8;

for (var i = 0; i &amp;lt; count; ++i)
{
    predicate((float)metadata[i], i);
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Feb 2023 06:45:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-maps-sdk-for-unity-questions/i-want-to-retrieve-and-display-3d-attribute-data/m-p/1255586#M426</guid>
      <dc:creator>dun82</dc:creator>
      <dc:date>2023-02-07T06:45:22Z</dc:date>
    </item>
  </channel>
</rss>

