wrld3d / unity-api

Issue tracking for the WRLD Unity SDK
28 stars 8 forks source link

Highlighting buildings "too fast" seems to lead to a BuildingsAPI dictionary failure #66

Closed yosun closed 6 years ago

yosun commented 6 years ago

temporarily fixed by setting private to public static Dictionary<int, HighlightRequest> HighlightRequests; and checking for BuildingsApi.HighlightRequests.ContainsKey(lastHighlighted.HighlightId)

since the callback seems stochastical when buildings are highlighted too fast, you may want to check for existence before calling it

https://gyazo.com/7958a4cc12e570263a1ba5e6f8b035ea

yosun commented 6 years ago
       if(HighlightRequests.ContainsKey(highlightRequestId)){ 
            var request = HighlightRequests[highlightRequestId];
            HighlightIdsToAdd.Add(highlightMeshId);
            var gameObject = HighlightStreamer.GetObjects(highlightMeshId)[0];
            gameObject.GetComponent<MeshRenderer>().sharedMaterial = request.material;
        }

BuildingsAPI.cs line 267ff

That's my fix for now - not sure if that might break other Wrld features...

tim-jenks commented 6 years ago

Accepting this as a known bug - will fix for next release

jonty-dawson commented 6 years ago

Fixed on v0.6, but involves api change - migration notes to follow

jonty-dawson commented 6 years ago

See snapshot docs: https://docs.wrld3d.com/unity-SNAPSHOT/latest/docs/examples/highlighting-buildings/ Migration notes on: https://docs.wrld3d.com/unity-SNAPSHOT/latest/docs/examples/whats-new-unity-sdk-0.6/

jonty-dawson commented 6 years ago

Snapshot package available here: https://eegeo-static.s3.amazonaws.com/unity/wrld.unity.sdk-SNAPSHOT.zip