{"action":"created","issue":{"url":"https://api.github.com/repos/mapbox/mapbox-unity-sdk/issues/648","repository_url":"https://api.github.com/repos/mapbox/mapbox-unity-sdk","labels_url":"https://api.github.com/repos/mapbox/mapbox-unity-sdk/issues/648/labels{/name}","comments_url":"https://api.github.com/repos/mapbox/mapbox-unity-sdk/issues/648/comments","events_url":"https://api.github.com/repos/mapbox/mapbox-unity-sdk/issues/648/events","html_url":"https://github.com/mapbox/mapbox-unity-sdk/issues/648","id":310976354,"number":648,"title":"SpawnInsideModifier not resetting on scene reload (with fix)","user":{"login":"demi180","id":12224422,"avatar_url":"https://avatars3.githubusercontent.com/u/12224422?v=4","gravatar_id":"","url":"https://api.github.com/users/demi180","html_url":"https://github.com/demi180","followers_url":"https://api.github.com/users/demi180/followers","following_url":"https://api.github.com/users/demi180/following{/other_user}","gists_url":"https://api.github.com/users/demi180/gists{/gist_id}","starred_url":"https://api.github.com/users/demi180/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/demi180/subscriptions","organizations_url":"https://api.github.com/users/demi180/orgs","repos_url":"https://api.github.com/users/demi180/repos","events_url":"https://api.github.com/users/demi180/events{/privacy}","received_events_url":"https://api.github.com/users/demi180/received_events","type":"User","site_admin":false},"labels":[{"id":570569204,"url":"https://api.github.com/repos/mapbox/mapbox-unity-sdk/labels/bug","name":"bug","color":"ee0701","default":true},{"id":570569206,"url":"https://api.github.com/repos/mapbox/mapbox-unity-sdk/labels/enhancement","name":"enhancement","color":"fbca04","default":true}],"state":"open","locked":false,"assignee":{"login":"atripathi-mb","id":32286016,"avatar_url":"https://avatars2.githubusercontent.com/u/32286016?v=4","gravatar_id":"","url":"https://api.github.com/users/atripathi-mb","html_url":"https://github.com/atripathi-mb","followers_url":"https://api.github.com/users/atripathi-mb/followers","following_url":"https://api.github.com/users/atripathi-mb/following{/other_user}","gists_url":"https://api.github.com/users/atripathi-mb/gists{/gist_id}","starred_url":"https://api.github.com/users/atripathi-mb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/atripathi-mb/subscriptions","organizations_url":"https://api.github.com/users/atripathi-mb/orgs","repos_url":"https://api.github.com/users/atripathi-mb/repos","events_url":"https://api.github.com/users/atripathi-mb/events{/privacy}","received_events_url":"https://api.github.com/users/atripathi-mb/received_events","type":"User","site_admin":false},"assignees":[{"login":"atripathi-mb","id":32286016,"avatar_url":"https://avatars2.githubusercontent.com/u/32286016?v=4","gravatar_id":"","url":"https://api.github.com/users/atripathi-mb","html_url":"https://github.com/atripathi-mb","followers_url":"https://api.github.com/users/atripathi-mb/followers","following_url":"https://api.github.com/users/atripathi-mb/following{/other_user}","gists_url":"https://api.github.com/users/atripathi-mb/gists{/gist_id}","starred_url":"https://api.github.com/users/atripathi-mb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/atripathi-mb/subscriptions","organizations_url":"https://api.github.com/users/atripathi-mb/orgs","repos_url":"https://api.github.com/users/atripathi-mb/repos","events_url":"https://api.github.com/users/atripathi-mb/events{/privacy}","received_events_url":"https://api.github.com/users/atripathi-mb/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/mapbox/mapbox-unity-sdk/milestones/10","html_url":"https://github.com/mapbox/mapbox-unity-sdk/milestone/10","labels_url":"https://api.github.com/repos/mapbox/mapbox-unity-sdk/milestones/10/labels","id":3228996,"number":10,"title":"S18.2.1","description":"","creator":{"login":"MiroMuse","id":5004302,"avatar_url":"https://avatars2.githubusercontent.com/u/5004302?v=4","gravatar_id":"","url":"https://api.github.com/users/MiroMuse","html_url":"https://github.com/MiroMuse","followers_url":"https://api.github.com/users/MiroMuse/followers","following_url":"https://api.github.com/users/MiroMuse/following{/other_user}","gists_url":"https://api.github.com/users/MiroMuse/gists{/gist_id}","starred_url":"https://api.github.com/users/MiroMuse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MiroMuse/subscriptions","organizations_url":"https://api.github.com/users/MiroMuse/orgs","repos_url":"https://api.github.com/users/MiroMuse/repos","events_url":"https://api.github.com/users/MiroMuse/events{/privacy}","received_events_url":"https://api.github.com/users/MiroMuse/received_events","type":"User","site_admin":false},"open_issues":27,"closed_issues":4,"state":"open","created_at":"2018-03-29T15:26:35Z","updated_at":"2018-04-05T20:07:08Z","due_on":"2018-04-12T07:00:00Z","closed_at":null},"comments":0,"created_at":"2018-04-03T19:58:52Z","updated_at":"2018-04-05T21:01:46Z","closed_at":null,"author_association":"NONE","body":"This has been the case since we started working with Mapbox, just now got around to fixing it. For our use we often need to just reload the current scene (easier than trying to reset specific objects).\r\n\r\nWith previous versions the buildings were also having trouble reloading, but now that seems to be working. But trees and other objects spawned with the SpawnInsideModifier are not properly respawning and instead an exception happens. Because the modifiers are ScriptableObjects, and everything still holds the temp data in SOs instead of in a runtime object.\r\n\r\nTo recreate, simply take a scene with some tree spawns, add in a script to reload current scene, ex:\r\n`SceneManager.LoadScene ( SceneManager.GetActiveScene ().name );`\r\nMy solution was to just safely destroy and clear any objects in this modifier object, like this:\r\n```C#\r\npublic override void Initialize()\r\n{\r\n\tif (_objects == null || _pool == null)\r\n\t{\r\n\t\t_objects = new Dictionary<GameObject, List<GameObject>>();\r\n\t\t_pool = new Queue<GameObject>();\r\n\t} else\r\n\t{\r\n\t\tforeach ( var pair in _objects )\r\n\t\t{\r\n\t\t\tforeach ( GameObject go in pair.Value )\r\n\t\t\t\tif ( go != null )\r\n\t\t\t\t\tDestroy ( go );\r\n\t\t\tif ( pair.Key != null )\r\n\t\t\t\tDestroy ( pair.Key );\r\n\t\t}\r\n\t\t_objects.Clear ();\r\n\t\twhile ( _pool.Count > 0 )\r\n\t\t{\r\n\t\t\tGameObject go = _pool.Dequeue ();\r\n\t\t\tif ( go != null )\r\n\t\t\t\tDestroy ( go );\r\n\t\t}\r\n\t}\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/mapbox/mapbox-unity-sdk/issues/comments/379075535","html_url":"https://github.com/mapbox/mapbox-unity-sdk/issues/648#issuecomment-379075535","issue_url":"https://api.github.com/repos/mapbox/mapbox-unity-sdk/issues/648","id":379075535,"user":{"login":"jordy-isaac","id":33474236,"avatar_url":"https://avatars3.githubusercontent.com/u/33474236?v=4","gravatar_id":"","url":"https://api.github.com/users/jordy-isaac","html_url":"https://github.com/jordy-isaac","followers_url":"https://api.github.com/users/jordy-isaac/followers","following_url":"https://api.github.com/users/jordy-isaac/following{/other_user}","gists_url":"https://api.github.com/users/jordy-isaac/gists{/gist_id}","starred_url":"https://api.github.com/users/jordy-isaac/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jordy-isaac/subscriptions","organizations_url":"https://api.github.com/users/jordy-isaac/orgs","repos_url":"https://api.github.com/users/jordy-isaac/repos","events_url":"https://api.github.com/users/jordy-isaac/events{/privacy}","received_events_url":"https://api.github.com/users/jordy-isaac/received_events","type":"User","site_admin":false},"created_at":"2018-04-05T21:01:46Z","updated_at":"2018-04-05T21:01:46Z","author_association":"NONE","body":"Thanks for letting us know and for your feedback on this @demi180 "}}
{"actor":{"display_login":"jordy-isaac"}}