-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Location Loader issue #229
Comments
So this is happening because the two exit locations ( forest to beach & beach to forest) happen to be on top of each other. If you move one of the two so that its not overlapping then you wont have this issue. The loading order is random, since we do both load and unload Asynch. So this is likely to trigger in the case where the new scene loads before the older scene is unloaded, thus the old pig triggers the enter in the new scene. This could also happen the other way if the spawn point happened to be on top of where an old trigger is in the other scene. Overall this could probably be prevented by: |
tested option D) 👍 seems to work fine |
Good point, that didn't occur to me at all! I agree with option D, but I have one more defensive solution to add: |
You might run into issues trying to position a scene, because it might not actually match real world sizes to each other, and which exit entrance combo should the pivot be on. Overall it might be more helpful to separate them in a grid instead ? |
Yes, that's sort of what I'm suggesting. It's basically like each scene is a piece of a grid. |
The scenes where being loaded additively. Unless there is a plan to do some fancy level phasing, the scenes should be loaded Video: https://youtu.be/9rZnrfmYvfw |
Scenes need to be loaded additively, because the game starts with an Initialization scene that must be persistent. That scene is responsible for displaying the loading screen interface between loads, managing audio, and possibly carry Player Data, along with other background operations. It's true that each scene in the project has a reference to the Initialization scene and automatically loads it on Start if it is not already present in the hierarchy, but that is meant for debugging purposes. Loading scenes with LoadSceneMode.Single will prevent that session's data from being carried, since the Initialization scene will be reloaded and therefore reset. |
Also we are sending an array of scenes ( meaning you could load several scenes if required) |
Ah, I see. Nothing is ever easy is it :D Ok, I closed the PR #231 and will take another look with that info in mind. Thanks. |
This reverts commit c7d75ff.
This reverts commit 14a6a3a.
…t scenes"" This reverts commit 3e9fb2d.
OK, I got it worked out. It now works as you guys said it should work. I also left some TODOs for expansion that I can come back to if needed. Pretty handy little scene loader. Still have lots to do though =) |
I think these are good changes, albeit :
PS: note that we don't prevent the new pig from possibly triggering something (other than exits) in the old scene yet. Possibly we should wait to spawn the new pig until we are sure the old scenes are unloaded ? |
@ErikBehar Good deal. Please explain "does not properly support loading multiple scenes" so I know what the intent is. I get the ability to layer scenes for phasing and such but it seems to be a very convoluted way of doing things just to persist data. Thanks. |
I agree with the changes too, but also think that @ErikBehar suggestion on adding a check method is essential to avoid issues. It's always safer to double-check when we are working with operations that handle a lot of instances at the same time. PS: As far as I've checked, @jandd661 changes do support loading multiple scenes; that's the whole point of the video posted. Are you missing something @ErikBehar ? |
@ErikBehar As for destroying the player, I wonder if it wouldn't be more reliable to do it in the Spawn method itself. Something like:
|
I think we want to destroy the old pig as early as possible, so on the exit script is the earliest... if you wait to the spawn, you might run into the same issues we are trying to prevent. I do think adding the wait for the new pig might be good idea, although I think it would be best to wait for all the old unloading scenes to be done loading instead of just the active scene. This would require listening to some event from the loader. |
Sorry, didnt look at the video, I only looked at the code changes, and I was looking at "SetActiveScene" function and wasn't completely sold on it working well when I read the code before. I see that its always setting active_scene now. I guess this is fine with the current assumption that the active scene should always be the first one. |
Seems acceptable to me. Maybe moving |
Thanks everyone, the issue is fixed... for now! |
* moved inventory scripts to align with project conventions * actually destroy the gameobject an not the component * added a background color to the item type * created player inventory and first ingredient which can be collected * make it possible to show items of inventory in inspector * made Item fields as they were before * hair color mask material, old lady hairdo and glass, moustache, and shell bowl Various art assets to make the townsfolk more unique. Bowl made from a giant shell. * Added trap to small testing ground Useful for testing * Fix for issue Location Loader issue UnityTechnologies#229 * Revert "Fix for issue Location Loader issue UnityTechnologies#229" This reverts commit c7d75ff. * Proposed fix for issue UnityTechnologies#229 with test scenes * Revert "Proposed fix for issue UnityTechnologies#229 with test scenes" This reverts commit 14a6a3a. * Revert "Revert "Proposed fix for issue UnityTechnologies#229 with test scenes"" This reverts commit 3e9fb2d. * Update Beach Scene with test data * Revert "Update Beach Scene with test data" This reverts commit 90ac457. * Updated Beach Scene with test data for Scene Loader * Update TestingGround_Small.unity Grouped object * Remove Fresnel properties from ToonShading subgraph I moved Albedo out from ToonShading and into the main shadergraph. I then created the new subgraph Albedo_Fresnel which contains the lerp operation needed for the slimes. The Albedo subgraph has been added to all toon shadergraph variants. * Fix Plant Critter mesh scaling and name (UnityTechnologies#239) * Townsfolk_M animations, Palm2 * Added Event that takes GameObject in parameter * Added events for pickup, cook and talk * Added interaction example scene * Added interaction manager script * Added interaction to main character prefab * Added Rigidbody component to the Interaction GO on the pig * Changed interaction key to E (From K) * Moved Interaction script to scripts folder * Added tags for interactions * Added examples to interaction example scene * Game input update after interaction key change * [Bot] Automated dotnet-format update * Remove Albedo Influence on Specular Light Brightness Swapping the order of the multiply and add nodes in the ToonShading subgraph to multiply albedo by diffuse light alone, then add specular highlights. Along with this is the need ability to control specular light transparency, which can now be done using the Specular Color property's alpha channel. * New tree type * Reset HasBeenPrewarmed (UnityTechnologies#243) * [WIP] Added some table furniture (UnityTechnologies#233) * Added some table furnitures * Corrected all furniture prefabs to be prefab variant * Added back recklol Dissolve effect (UnityTechnologies#217) * Added recklol dissolve effect with some tweaks * Added names to dissolve outputs * Added a dissolve effect option in contextual menu and add alpha cutoff in Toon_Disolve * [Bot] Automated dotnet-format update * updated interaction manager * interaction ui event * [Bot] Automated dotnet-format update * Imported Smurjo's models, reorganised folders * Hotfix for null checking `ToState`. (UnityTechnologies#244) * Wiki and Readme images * Update README.md * TownAssets More enviroment 3D assets. -Small house in the same style. -Empty market stands -Small market items for decoration -A door. * Added interaction UI when interaction ends * Update README.md * Added enable UI action map from InputReader * Updates on interaction manager * Interaction go on the pig is now a prefab * Added pick up sfx and play sound action * Added pick up state to the state machine * pickUp state in states folder * Added item event type * Added dialogue event type * removed comment from Interaction UI event channel * Added interaction events and updated interaction manager * pushing interaction example scene * Added isPickingUp SO condition to state machine * Added pickup state to state machine * Added timer pick animation condition and is picking up condition * Added pick up trigger action to state machine * updated pig chef animator controller for pick up animation * [Bot] Automated dotnet-format update * start talking interaction event name updated * Initial decoupling of CameraManager and SpawnSystem. Spawn system still needs reference to CameraManager, because it must provide it to Protagonist. * Updated prefabs * Added description to EventChannels * Introduced RuntimeAnchors Used in Spawn and CameraSystem for decoupling purposes * [Bot] Automated dotnet-format update * Added Frying Pan asset (UnityTechnologies#252) * Added Frying pan assets * Changed material smothness * Updated furnishing texture and colliders on furniture (UnityTechnologies#251) * Issue UnityTechnologies#245 simple fix for camera erratic behaviour (UnityTechnologies#250) * hair color mask material, old lady hairdo and glass, moustache, and shell bowl Various art assets to make the townsfolk more unique. Bowl made from a giant shell. * Fix Plant Critter mesh scaling and name (UnityTechnologies#239) * Townsfolk_M animations, Palm2 * New tree type * simple fix for camera * Reset HasBeenPrewarmed (UnityTechnologies#243) * [WIP] Added some table furniture (UnityTechnologies#233) * Added some table furnitures * Corrected all furniture prefabs to be prefab variant * Added back recklol Dissolve effect (UnityTechnologies#217) * Added recklol dissolve effect with some tweaks * Added names to dissolve outputs * Added a dissolve effect option in contextual menu and add alpha cutoff in Toon_Disolve * [Bot] Automated dotnet-format update * Imported Smurjo's models, reorganised folders * Hotfix for null checking `ToState`. (UnityTechnologies#244) * Wiki and Readme images * Update README.md * Update README.md * Initial decoupling of CameraManager and SpawnSystem. Spawn system still needs reference to CameraManager, because it must provide it to Protagonist. * Updated prefabs * Added description to EventChannels * Introduced RuntimeAnchors Used in Spawn and CameraSystem for decoupling purposes * [Bot] Automated dotnet-format update * Changed the wait to EndOfFrame Co-authored-by: Smurjo <Johanna@johanland.de> Co-authored-by: treivize <42570903+treivize@users.noreply.github.com> Co-authored-by: Ciro Continisio <ciro@unity3d.com> Co-authored-by: Dave Rodriguez <drod7425@gmail.com> Co-authored-by: David Lischinsky <david.lischinsky@outlook.com> Co-authored-by: Jan Urbanec <UrbanecJ@seznam.cz> * State Machine - Proposed fix for Issue 228 (UnityTechnologies#227) * Added Sliding to JumpAscending Player was unable to jump if sliding which caused the player to get stuck in geometry/holes. * Added IsActuallyMoving Condition SO and update PigChef Transition Table IsActuallyMovingSO evaluates character movement by the character controller's velosity.sqrMagnitude. Returns true if the character controller is moving beyond the threshold. Characters can no longer jump while sliding but can jump if they get stuck. * Update .gitignore * Small fixes Reconnected disconnected assets in the TransitionTable, reverted changes on the .gitignore, added multiplication in threshold verification equation Co-authored-by: Ciro Continisio <ciro@unity3d.com> * [Bot] Automated dotnet-format update * Shader tweaks and reorganisation * Shading style wiki images * Add files via upload * Add UI system, Inventory UI and update Inventory System * [Bot] Automated dotnet-format update * Fixes to example, moved files in Examples folder * [Bot] Automated dotnet-format update * Switched layers of occluding objects * Leftover lightmaps * Relocated stray assets * post merge fixes * Fixed event for interaction pick up * Changed Events to Event Channels * [Bot] Automated dotnet-format update * added null check before event raise on interaction * [Bot] Automated dotnet-format update * bard hare in interaction example scene for talk interaction test * Adding interaction UI + Events * Fix last commit * [Bot] Automated dotnet-format update * updated event name for interaction ended * Adding initialization script * [Bot] Automated dotnet-format update * Add an on Interaction Ended Event raise * [Bot] Automated dotnet-format update * Added collider on bard hare prefab * updated example scene for interaction * testing ground scene cleaning * Imported ground textures * New FryKing animations and prefab * Renamed UI scene to gameplay scene * Removed old comments from InteractionManager * First setup * Small fixes * ChefHat accessory * palm leaf set and lobster Prefabs for the cooking festival * New art assets * setup IK for the pig on the arms * Added small internal cooldown to the PlayLandParticlesAction StateAction (UnityTechnologies#260) * Added small internal cooldown to PlayLandParticlesAction StateAction https://open.codecks.io/unity-open-project-1/decks/15-code/card/18k-avoid-spamming-particles-on-sliding Whenever the PlayLandParticlesAction StateAction is exited by the state machine, it checks if total elapsed time is greater then the total elapsed time of the last particle call + a small amount. If so, only then do we tell the DustParticle Controller to play, and we also set the new time to beat to be the current time. * Update PlayLandParticlesActionSO.cs Removed the unnecessarily verbose extra function Co-authored-by: Ciro Continisio <ciro@unity3d.com> * [Bot] Automated dotnet-format update * Fix/LocationSO not serialized properly (UnityTechnologies#258) * Fix GameSceneSO not serialized properly. * Add a reference to the script as a ObjectField in the GameSceneSO To edit the code faster * Fix typo * Renaming and cleaning folders * clening assets folder * Add control over cooking when near pot * [Bot] Automated dotnet-format update * Added new interaction scene example * Skybox experiments * ClearSky skybox * Reworked the CM camera, added collider, noise * Reorganised scenes * Removes spaces in scene names * Bushes, new Fern plant * Reintroduced camera noise * Update ReplaceTool.cs (UnityTechnologies#221) * "Replace" context-menu with a searchable popup (UnityTechnologies#223) * "Replace" context-menu with a popup window * [Bot] Automated dotnet-format update * Selection interactive preview * Whoops, wrong merge resolve * [Bot] Automated dotnet-format update * Show popup at screen mouse position * Mini-previews on renderable objects + minor GUI improvements * [Bot] Automated dotnet-format update * Editors cache fix, remove dummy editor * Destroy only cached editor * Rename "ReplacePrefabTreeView" to "PrefabSelectionTreeView" * catch ClearPreviewCache error * fix null texture warning * Fix popup fit on smaller screens * Fix black frame when closing popup during repaint * Expand folder on single-click * Remove editor Destroy, as error is still showing inside try catch * Revert delayed close, as it made popup not-closable in some cases * Added editor for ScriptableObject with events. It allows to automatically show buttons for each event and raise them. (UnityTechnologies#256) * "Editor window to quickly open scenes" task (UnityTechnologies#267) * Added the Quick Scene Access Tool * removed unused file * [Bot] Automated dotnet-format update * Imported lobster, palm leaf set, tavern owner's hair * AnimationRigging setup, lantern grab clip * Added BardHare and FryKing animations * Added Run and Faint animation for PigChef, implemented Run as BlendTree * Removed Localisation samples * Added the ability to run for keyboard players * Input and Camera tweaking * Input and Camera tweaking * [Bot] Automated dotnet-format update Co-authored-by: circa94 <hannesklose@hotmail.de> Co-authored-by: Chema Damak <chema.damak@unity3D.com> Co-authored-by: Llaczky <72225106+Llaczky@users.noreply.github.com> Co-authored-by: Smurjo <Johanna@johanland.de> Co-authored-by: jandd661 <74697341+jandd661@users.noreply.github.com> Co-authored-by: Dane Byrd <daneobyrd@gmail.com> Co-authored-by: treivize <42570903+treivize@users.noreply.github.com> Co-authored-by: Ciro Continisio <ciro@unity3d.com> Co-authored-by: Amel Negra <amel.negra@unity3d.com> Co-authored-by: Dave Rodriguez <drod7425@gmail.com> Co-authored-by: Jan Urbanec <UrbanecJ@seznam.cz> Co-authored-by: erizzoalbuquerque <erizzoalbuquerque@gmail.com> Co-authored-by: Erik Behar <invadererik@gmail.com> Co-authored-by: John McAllister <jandd661@gmail.com> Co-authored-by: Smurjo <73852662+Smurjo@users.noreply.github.com> Co-authored-by: MTrecozzi <47111522+MTrecozzi@users.noreply.github.com> Co-authored-by: Rainaldi Satria <57592497+rainaldisatria@users.noreply.github.com> Co-authored-by: uChema <59874519+uChema@users.noreply.github.com> Co-authored-by: juicedup12 <37230501+juicedup12@users.noreply.github.com> Co-authored-by: Neonage <alexander.neonage@gmail.com> Co-authored-by: Can Chen <canchen@usc.edu>
Short description
I have spotted an issue with the Location Loader where, at some point, an error will cause two locations to be stacked, which results in critical bugs, like having two instances of the Player at the same time.
Expected behaviour
New scenes/locations must be able to load seamlessly, without causing errors. Therefore, previous scenes must be unloaded first.
To Reproduce
Notes
Screenshot
The text was updated successfully, but these errors were encountered: