Select to view content in your preferred language

Local .slpk file is not loading into scene

745
12
Jump to solution
08-19-2024 02:31 PM
NickGuzi
Occasional Contributor

Hello! I recently created a project in which I added an integrated mesh layer through a URL for a scene and it worked just fine. 

I recently started a new project and am attempting to use a local .slpk file I have but the layer is not loading into the scene for some reason? Is it possible to add a local .slpk layer to a scene/is it recommended? Or is it always better to use a URL? 

I am positive I have the correct coordinates for my location, and I know it isn't a project issue as I tested with the integrated mesh layer URL I had used on my previous project and that loaded into this new project scene just fine. 

The local .slpk file is either a 3DObject Scene Layer or a Building Scene layer. I can't remember which at the moment but I did test with both configurations on the UI and neither loaded in. 

Please let me know if you have any follow up questions or need images sent over from my project.

Thanks!

- Nick 

0 Kudos
1 Solution

Accepted Solutions
NickGuzi
Occasional Contributor

For those who are concerned I just had to do some moderate tweaking to the script that Mason attached. I decided to use a tag to find the arcGISMapComponent housed within the ArcGISMap game object and it worked. I just named the tag "ArcGISMap" and assigned it to the ArcGISMap game object. Here is my updated script: 

private void Awake()
    {
        GameObject arcGISMap = GameObject.FindWithTag("ArcGISMap");
        if (arcGISMap != null)
        {
            arcGISMapComponent = arcGISMap.GetComponent<ArcGISMapComponent>();
            if (arcGISMapComponent == null)
            {
                Debug.LogError("ArcGISMapComponent is not found on the GameObject with tag 'ArcGISMap'.");
            }
        }
        else
        {
            Debug.LogError("No GameObject with tag 'ArcGISMap' found.");
        }
    }

 

Thank you for the help Mason! 

View solution in original post

0 Kudos
12 Replies
NickGuzi
Occasional Contributor

^ I forgot to add that the .slpk is housed within the Assets folder currently. I am referencing it with a direct file path not a relative file path.

0 Kudos
MasonGaw
Regular Contributor

Hello, 

If you are going to be loading an .slpk, we do not recommend keeping it within your project. This can cause issues with the path when making a build. If you plan to package/build your project for use on multiple devices, we recommend finding your platforms "Application.persistentdatapath", placing the .slpk there, and loading it via a C# script in the Start method. Attached is the script, please modify to fit your needs. 

If you wish to not use a script, please consider placing the .slpk in a location on your computer such as Downloads, Desktop, or Documents and using the path. 
Please let me know if you have any other questions or issues.

Mason

0 Kudos
NickGuzi
Occasional Contributor

Sounds good I'll try it out, thanks!

0 Kudos
NickGuzi
Occasional Contributor

I just realized I left out one key ingredient. I am trying to build my game into a WebGL platform. How would that affect this process? Is it possible to use a local .slpk within a WebGL game? In fact is it recommended/possible to use the SDK and build into a WebGL platform in general?

0 Kudos
MasonGaw
Regular Contributor

Unfortunately, we do not support WebGL at this time. We apologize for the inconvenience.
Mason

0 Kudos
NickGuzi
Occasional Contributor

Ah I see, thank you! So WebGL isn't supported in any capacity by the SDK? Or is it only not supported if trying to use a local .slpk file?

0 Kudos
NickGuzi
Occasional Contributor
0 Kudos
NickGuzi
Occasional Contributor

@MasonGaw so I took your advice and added my .slpk to the persistentdatapath. I then added the script to my Unity project (I changed the layer to an ArcGIS3DObjectSceneLayer within the Start() method). I added the script to my scene through an empty object below the ArcGISMap object. This is what it looks like: 

NickGuzi_0-1724345189635.png

NickGuzi_1-1724345205263.png

However, upon clicking play the layer is still not showing up. Is there something I am missing? Or do you think there's an actual issue with my .slpk? My persistentdatapath is as follows: C:\Users\[Username]\AppData\LocalLow\DefaultCompany\Project_Name

 

0 Kudos
NickGuzi
Occasional Contributor

For those who are concerned I just had to do some moderate tweaking to the script that Mason attached. I decided to use a tag to find the arcGISMapComponent housed within the ArcGISMap game object and it worked. I just named the tag "ArcGISMap" and assigned it to the ArcGISMap game object. Here is my updated script: 

private void Awake()
    {
        GameObject arcGISMap = GameObject.FindWithTag("ArcGISMap");
        if (arcGISMap != null)
        {
            arcGISMapComponent = arcGISMap.GetComponent<ArcGISMapComponent>();
            if (arcGISMapComponent == null)
            {
                Debug.LogError("ArcGISMapComponent is not found on the GameObject with tag 'ArcGISMap'.");
            }
        }
        else
        {
            Debug.LogError("No GameObject with tag 'ArcGISMap' found.");
        }
    }

 

Thank you for the help Mason! 

0 Kudos