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.
I primarily followed the Display a map (C# API) 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.
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!"
The full error for the NullReferenceException is:
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)
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.)
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:
Can't add 'ArcGISCameraControllerComponent' to Main Camera because a 'ArcGISCameraControllerComponent' is already added to the game object!
I also tried using the component-based workflow from the Display a map (Components) 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.
I'm using 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.
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!