-
Notifications
You must be signed in to change notification settings - Fork 211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SpawnInsideModifier not resetting on scene reload (with fix) #648
Comments
Thanks for letting us know and for your feedback on this @demi180 |
@demi180 thanks for the detailed ticket. I think we tend to look over scene change cases as we focus more on map reloads (without changing the scene). cc @atripathi-mb |
@brnkhy yes, you're right. Our particular case isn't moving around the map, we're just using one chunk at a time. I'd be just as happy to keep all the cached data on reload. I could probably just add a DontDestroy and a check to our map object to circumvent this problem entirely, now that I think about it. I can even do that without modifying any of your scripts. I have no specific need to re-randomize the building textures and tree placement. In fact it'd be easier for the trees to stay the same in this case, since we've got Python scripts that have to receive all the collision information... Edit: Looks like I do need minor modification for that, because AbstractMap.OnDestroy is still being called from the Destroy call inside the DDOL. |
@demi180 glad to hear it works well for now. We'll probably look into this soon as a part of bigger review/refactor so won't rush a fix if everything works for you now. |
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).
With 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.
To recreate, simply take a scene with some tree spawns, add in a script to reload current scene, ex:
SceneManager.LoadScene ( SceneManager.GetActiveScene ().name );
My solution was to just safely destroy and clear any objects in this modifier object, like this:
The text was updated successfully, but these errors were encountered: