Comments (8)
yes the issue is that the pool gets created in the Active Scene, when the active scene is destroyed, the pool goes with it.
There is clearly a line already in the code that is commented :
ComponentPoolSO: ( line 24 ) //DontDestroyOnLoad(_poolRootObject);
The problem here is that this is a generic system, so I think some pools we do want to destroy and some pools we don't !
One solution might be to pass in a transform where you want your pool to exist at, that way if you want your pool to survive scene loads, you can instantiate it with a root transform in a scene that is not destroyed, otherwise you can pass in null and that should put it in the active scene.
from open-project-1.
I reproduced it on my machine, and by asking unity to not destroy the SoundEmitterPool on load, seems to fix the issue.
I'm new to the project and would like to continue with the fix. I'm not very experienced with Unity, if someone has a better approach on this let me know!
from open-project-1.
A good first issue.
Yeah, since it's generic, we want to have control of both approach (Destroyed after scene loaded, or the opposite).
My proposition is to add boolean property to ComponentPoolSO called Global or something like that. Then in the SoundEmitterPoolSO, we set the Global = true (Not destroyed after scene loading) in the OnEnable() method
from open-project-1.
Hah I actually was just working on this. I'm not super familiar with this issue, but if it's caused by DDOL, it should be fixable once #215 is merged.
Solution would be to call Pool.SetParent(t) where t is a transform of an object marked DDOL.
from open-project-1.
Hah I actually was just working on this. I'm not super familiar with this issue, but if it's caused by DDOL, it should be fixable once #215 is merged.
Solution would be to call Pool.SetParent(t) where t is a transform of an object marked DDOL.
so in your solution the parent is always assumed to be the object the script is on ? Do you prefer to surface the transform as a user facing variable instead ? I see a code path, but not something a user can tweak with out code, I guess can expose that on the using script.
from open-project-1.
so in your solution the parent is always assumed to be the object the script is on ? Do you prefer to surface the transform as a user facing variable instead ? I see a code path, but not something a user can tweak with out code, I guess can expose that on the using script.
No assumptions. I think it's easiest in a manager architecture to just use the manager's transform, but there is no preference as far as the pool is concerned. As for changing the targeted transform for parenting in the editor, yes, I would expose a field for the script in the inspector and use that instead.
from open-project-1.
Should be fixed by the changes that @davejrodriguez did to the Object Pool. I'll verify later and close it, if necessary.
Thanks @rainaldisatria for reporting it!
from open-project-1.
ok you added the setParent line yourself @ciro-unity so yes feel free to close this.
from open-project-1.
Related Issues (20)
- Loading the currently loaded scene gives error. HOT 1
- NullReferenceException when entering dark red block HOT 4
- Build error: type or namespace name 'Localization' does not exist in the namespace 'UnityEditor' HOT 2
- Horizontal movement is stuck on rock
- Jumping into wall adds excessive speed
- First quest area to Field Hill can be missed HOT 1
- No collider on oven HOT 2
- Question: What about Assemblies?
- Question: Properly Loading with ScriptableObjects and its Events
- Cannot Play the Game with Unity 2020.3.26f1 LTS Due to Addressable Errors
- Opening State Machine Editor Window crashes Unity in 2021.2.9 and newer HOT 1
- Audio Save System Bug
- Loading screen does not support 21:9 screens
- Character stuck inside the tree
- I cant open the ZIP file HOT 1
- Shader error: Invalid subscript 'shadowCoord' when try build for mac
- Operation Suggest
- New game template?
- Cannot Analyze Addressable in project with Unity 2022.3.5f1 LTS
- 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from open-project-1.