<?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: Errors with attaching script components from ArcGIS Maps SDK for Unity in ArcGIS Maps SDK for Unity Questions</title>
    <link>https://community.esri.com/t5/arcgis-maps-sdk-for-unity-questions/errors-with-attaching-script-components-from/m-p/1399332#M797</link>
    <description>&lt;P&gt;Not sure if there is anything related to your script, but it seems like there are some repetitive/missing components on the MainCamrea from your screenshots. If your "RITScene" script is based on the C# API tutorial, it should automatically add all those necessary camera components to your MainCamera gameobject once you enter the Play mode. You don't need to manually add those components as the script is already handling it. So I would first try to manually deleting all those redundant components from the inspector and only keep your "RITScene" along with your other custom scripts (weather, etc.) you might have as the screenshots below:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="and1_0-1711057290492.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/98727iB0BFD993B1C04ADC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="and1_0-1711057290492.png" alt="and1_0-1711057290492.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Then enter the Play mode, now you'll notice that the script will load all those camera related components:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="and1_1-1711057414354.png" style="width: 331px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/98728i2319BE430C56CEC3/image-dimensions/331x488?v=v2" width="331" height="488" role="button" title="and1_1-1711057414354.png" alt="and1_1-1711057414354.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Give a quick try and see if this works.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 21 Mar 2024 21:59:08 GMT</pubDate>
    <dc:creator>and1</dc:creator>
    <dc:date>2024-03-21T21:59:08Z</dc:date>
    <item>
      <title>Errors with attaching script components from ArcGIS Maps SDK for Unity</title>
      <link>https://community.esri.com/t5/arcgis-maps-sdk-for-unity-questions/errors-with-attaching-script-components-from/m-p/1391992#M787</link>
      <description>&lt;P&gt;Hello! I'm working on a Unity project using the ArcGIS Maps SDK, and it was working fine when I signed out of my work computer yesterday, but is now throwing errors which I believe are related to loading the component scripts that come with the SDK.&lt;/P&gt;&lt;P&gt;I primarily followed the &lt;A title="Display a map (C# API)" href="https://developers.arcgis.com/unity/maps/tutorials/display-a-map-api/" target="_blank" rel="noopener"&gt;Display a map (C# API)&lt;/A&gt; ArcGIS Developers tutorial to get the code for displaying the map, and modified the code slightly to display my own building feature layer. The program used to display the buildings both while playing and in the editor, but now only displays in the editor.&lt;/P&gt;&lt;P&gt;Both while playing and in the editor, the program throws errors. Upon loading the scene in the editor or just returning to the editor by stopping the project, a NullReferenceException is thrown. Hitting the play button throws that same NullReferenceException and a number of warnings just saying "The referenced script (Unknown) on this Behavior is missing!"&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="PlayingErrors.PNG" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/97097iAC59E089909A2B11/image-size/large?v=v2&amp;amp;px=999" role="button" title="PlayingErrors.PNG" alt="PlayingErrors.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The full error for the NullReferenceException is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markdown"&gt;NullReferenceException: Object reference not set to an instance of an object
Esri.ArcGISMapsSDK.Components.ArcGISEditorCameraComponent.set_EditorViewEnabled (System.Boolean value) (at ./Library/PackageCache/com.esri.arcgis-maps-sdk@4daa00a77df6/SDK/Components/ArcGISEditorCameraComponent.cs:72)
Esri.ArcGISMapsSDK.Components.ArcGISMapComponent.OnEnable () (at ./Library/PackageCache/com.esri.arcgis-maps-sdk@4daa00a77df6/SDK/Components/ArcGISMapComponent.cs:678)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The Main Camera now has extra "(Script)" components that seem to have not loaded properly, and I believe they're the cause of the missing script warnings that appear when playing the project. ("RIT Scene" is the script I wrote based on the tutorial.)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="CameraInspector.PNG" style="width: 787px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/97099i0F998883AB37C318/image-size/large?v=v2&amp;amp;px=999" role="button" title="CameraInspector.PNG" alt="CameraInspector.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Unity also throws a message in addition to the usual NullReferenceException when I first open the project after reverting to my Git commit from yesterday:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markdown"&gt;Can't add 'ArcGISCameraControllerComponent' to Main Camera because a 'ArcGISCameraControllerComponent' is already added to the game object!&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Errors1.PNG" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/97098i3F0B78C805AD2361/image-size/large?v=v2&amp;amp;px=999" role="button" title="Errors1.PNG" alt="Errors1.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I also tried using the component-based workflow from the &lt;A title="Display a map (Components)" href="https://developers.arcgis.com/unity/maps/tutorials/display-a-map-comp/" target="_blank" rel="noopener"&gt;Display a map (Components)&lt;/A&gt; ArcGIS Developers tutorial, but ran into a roadblock when the ArcGIS Camera component refused to be added to the Main Camera object. It presents an error box saying "Can't add script component 'ArcGISCameraComponent' because the script class cannot be found. Make sure that there are no compile errors and that the file name and class name match." I think this may be a clue as to the underlying problem, suggesting the components weren't imported correctly or aren't being referenced correctly. That said, I don't know why the script-based workflow still seemingly locates them properly while the project is playing when the Unity editor itself can't.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Errors4.PNG" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/97101i0A8D90C7BB3996FA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Errors4.PNG" alt="Errors4.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I'm using&amp;nbsp;Unity Editor version 2022.3.4f1 and Maps SDK version 1.4.0, which I imported from the .tgz available for download on the Esri website. I'm also using GitHub for version control.&lt;/P&gt;&lt;P&gt;If you can help me diagnose the problem and get the map displaying consistently in both the player and the editor, I would appreciate it very much!&lt;/P&gt;</description>
      <pubDate>Wed, 06 Mar 2024 17:26:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-maps-sdk-for-unity-questions/errors-with-attaching-script-components-from/m-p/1391992#M787</guid>
      <dc:creator>OwenGebhardt</dc:creator>
      <dc:date>2024-03-06T17:26:08Z</dc:date>
    </item>
    <item>
      <title>Re: Errors with attaching script components from ArcGIS Maps SDK for Unity</title>
      <link>https://community.esri.com/t5/arcgis-maps-sdk-for-unity-questions/errors-with-attaching-script-components-from/m-p/1399332#M797</link>
      <description>&lt;P&gt;Not sure if there is anything related to your script, but it seems like there are some repetitive/missing components on the MainCamrea from your screenshots. If your "RITScene" script is based on the C# API tutorial, it should automatically add all those necessary camera components to your MainCamera gameobject once you enter the Play mode. You don't need to manually add those components as the script is already handling it. So I would first try to manually deleting all those redundant components from the inspector and only keep your "RITScene" along with your other custom scripts (weather, etc.) you might have as the screenshots below:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="and1_0-1711057290492.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/98727iB0BFD993B1C04ADC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="and1_0-1711057290492.png" alt="and1_0-1711057290492.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Then enter the Play mode, now you'll notice that the script will load all those camera related components:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="and1_1-1711057414354.png" style="width: 331px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/98728i2319BE430C56CEC3/image-dimensions/331x488?v=v2" width="331" height="488" role="button" title="and1_1-1711057414354.png" alt="and1_1-1711057414354.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Give a quick try and see if this works.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2024 21:59:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-maps-sdk-for-unity-questions/errors-with-attaching-script-components-from/m-p/1399332#M797</guid>
      <dc:creator>and1</dc:creator>
      <dc:date>2024-03-21T21:59:08Z</dc:date>
    </item>
    <item>
      <title>Re: Errors with attaching script components from ArcGIS Maps SDK for Unity</title>
      <link>https://community.esri.com/t5/arcgis-maps-sdk-for-unity-questions/errors-with-attaching-script-components-from/m-p/1399756#M798</link>
      <description>&lt;P&gt;Just tried this; I deleted all ArcGIS-related components from the main camera, including HPTransform and my RITScene component (which I have since renamed to ArcGISScene after some refactoring), then unparented it from the ArcGISMap object so I could delete that too. I then added the ArcGISScene component back onto the camera and ran the scene so it could regenerate its various ArcGIS components. Unfortunately the same error still shows up. Like before, the map works just fine when the project is running, but when I stop the project the map doesn't show up in the editor despite having the [ExecuteAlways] attribute at the top of ArcGISScene.cs.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="CameraAfterRegenerating.PNG" style="width: 505px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/98810iE553F62B3D77A5D5/image-size/large?v=v2&amp;amp;px=999" role="button" title="CameraAfterRegenerating.PNG" alt="CameraAfterRegenerating.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I also noticed a few differences between our screenshots of the inspector for the main camera. My ArcGIS Camera and Rebase both always appear disabled, and clicking the checkbox to enable them doesn't appear to actually tick the box. Also, when I right-click either of them and select "Edit Script," then instead of opening it in my IDE like it does with my own scripts and other ArcGIS ones, it just opens this blank "(Mono Script)" window in the Inspector:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="InspectorRebaseEditScript.PNG" style="width: 503px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/98814i5850F3412B4CA56C/image-size/large?v=v2&amp;amp;px=999" role="button" title="InspectorRebaseEditScript.PNG" alt="InspectorRebaseEditScript.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I'll bet that has something to do with the issue, since the line in ArcGISEditorCameraComponent.cs that creates the error is calling GetComponent&amp;lt;ArcGISCameraComponent&amp;gt;()... but I do wonder what could be stopping the scripts from loading, and how we could fix it.&lt;/P&gt;&lt;P&gt;Either way, thank you for your response!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Mar 2024 17:59:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-maps-sdk-for-unity-questions/errors-with-attaching-script-components-from/m-p/1399756#M798</guid>
      <dc:creator>OwenGebhardt</dc:creator>
      <dc:date>2024-03-22T17:59:07Z</dc:date>
    </item>
  </channel>
</rss>

