magique
Full Member
 
Posts: 194
Posts: 194
|
Post by magique on Jan 31, 2018 4:08:33 GMT
I'm seeing an issue where after the game is running for a little while I suddenly get a huge CPU spike. Here is a profiler snapshot. 
|
|
|
Post by DarkTonic Dev on Jan 31, 2018 17:26:26 GMT
Yes debug calls are expensive. What is it logging? Something important that you need to fix no doubt.
|
|
magique
Full Member
 
Posts: 194
Posts: 194
|
Post by magique on Jan 31, 2018 17:30:52 GMT
I'll have to check, but there shouldn't be any logging. I thought I turned off the logging to avoid this sort of thing. I don't recall seeing any log message at all.
However, why would it be calling RegisterInSceneObjects() deep into gameplay? The scene has been playing for a while before this comes up.
|
|
|
Post by DarkTonic Dev on Jan 31, 2018 17:53:07 GMT
It won't normally. Maybe something's getting Instantiated by another plugin or something? You'll have to figure that out. The logging will help you figure that out.
Make sure you haven't accidentally turned off warnings in the Console window. It's definitely logging something.
|
|
magique
Full Member
 
Posts: 194
Posts: 194
|
Post by magique on Jan 31, 2018 17:54:49 GMT
OK. I'll check again tonight.
|
|
|
Post by DarkTonic Dev on Jan 31, 2018 18:05:27 GMT
I looked at the code again. The only thing that can be getting logged is "can't create item because auto-add items is off". Which means the item isn't configured in Pool Boss. Anyway though, RegisterInSceneObjects cannot be called again unless you manually called PoolBoss.Initialize() or reloaded the Scene (with a non-persistent LevelSettings) or something like that.
Hope that helps.
|
|
magique
Full Member
 
Posts: 194
Posts: 194
|
Post by magique on Jan 31, 2018 18:08:16 GMT
Yeah, I looked at the code too and saw that warning, but it didn't seem to apply to my situation. And I'm definitely not calling PoolBoss.Initialize() myself. I will know more tonight hopefully.
|
|
|
Post by DarkTonic Dev on Jan 31, 2018 20:42:46 GMT
Ok, let me know. From the code, those are the only 2 possibilities I saw.
|
|
magique
Full Member
 
Posts: 194
Posts: 194
|
Post by magique on Feb 1, 2018 4:37:04 GMT
OK, so I had warnings off and when I turn on, here is and example of what I see:
Could not create Pool Boss item for in-Scene game object 'element_13_1_air' because Auto-Add Missing Items is turned off. UnityEngine.Debug:LogWarning(Object) DarkTonic.CoreGameKit.PoolBoss:RegisterInSceneObjects() (at Assets/Plugins/DarkTonic/CoreGameKit/Scripts/PoolBoss/PoolBoss.cs:166) DarkTonic.CoreGameKit.PoolBoss:Update() (at Assets/Plugins/DarkTonic/CoreGameKit/Scripts/PoolBoss/PoolBoss.cs:143)
The problem is that I have an object in PoolBoss that has child components. Some of the child components I've made Killable because I want the player ship to be damaged when they collide. But those child items are not in PoolBoss. But why should they be? Why is it trying to add them to the pool? They're part of a pooled object already and each individual component of the object shouldn't have to be pooled. I'm not creating them individually, but only as a component of the master item that is pooled.
|
|
magique
Full Member
 
Posts: 194
Posts: 194
|
Post by magique on Feb 1, 2018 5:01:04 GMT
I looked at the code again. The only thing that can be getting logged is "can't create item because auto-add items is off". Which means the item isn't configured in Pool Boss. Anyway though, RegisterInSceneObjects cannot be called again unless you manually called PoolBoss.Initialize() or reloaded the Scene (with a non-persistent LevelSettings) or something like that. Hope that helps. I checked the code again and you are calling registerInSceneObjects on every PoolBoss Update. void Update() {
if (_isReady) {
RegisterInSceneObjects();
_changes++;
return;
}
ContinueInit();
}
|
|
|
Post by DarkTonic Dev on Feb 1, 2018 5:20:25 GMT
Yeah, looking at the code again. If there are any in-scene objects that have notified Pool Boss since the last frame that they are there, RegisterInSceneObjects will add them to the spawned count. That's correct.
The child objects do not need to be in Pool Boss, but if they have the PoolableInfo script on them, they will try to register with Pool Boss and fail. So take that script off any objects that aren't supposed to be in Pool Boss. I'll bet you have it on one of them.
|
|
magique
Full Member
 
Posts: 194
Posts: 194
|
Post by magique on Feb 1, 2018 5:55:17 GMT
Those child objects don't have PoolableInfo on them. They never did.
|
|
|
Post by DarkTonic Dev on Feb 1, 2018 18:16:19 GMT
Then I have no more help for you. That script is the one that notifies Pool Boss to register.
You will have to send me an example scene to debug.
|
|
magique
Full Member
 
Posts: 194
Posts: 194
|
Post by magique on Feb 1, 2018 18:18:50 GMT
For now I've just commented out the warning since it has no value to me anyway. If I have time I'll get a sample scene to send to you.
|
|
|
Post by DarkTonic Dev on Feb 1, 2018 18:53:58 GMT
Ok, then obviously I won't be able to fix it.
|
|