Cache deleting identities Approach #1 - #56
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Applied the cached mid-delete resolution fix to the predicted physics systems
| finally | ||
| { | ||
| UnregisterPooledInstance(instance); | ||
| pool.Delete(instance); | ||
| if (!isSimulating) | ||
| EndDeletingInstance(deletingIds); | ||
| } |
There was a problem hiding this comment.
After a quick test, this should never be the case (as long as users are calling PredictedHierarchy.Delete() during sim) and can therefore be removed. This entire try/finally as well as EndDeletingInstance can be removed. That said, it's not really harmful either and may help in the case of PredictedHierarchy misuse.
This keeps a cache of deleted identities until PostSimulate has been run. This allows resolving the GameObject of PredictedIdentities deleted during the previous simulation tick.
Opening this as a draft because I'm not thrilled with the asymmetry I've introduced between
PredictedComponentID.GetGameObjectandPredictedComponentID.GetIdentity. I think this change should go in one of the following directions:PredictedComponentID.GetIdentityIncludingDeleting(or similar) method that is then called by the predicted physics system(s) when firing events.PredictionManager.GetIdentity. Happy to hear thoughts and feedback.EDIT: I went ahead and implemented both of the above approaches. This PR contains the lighter method of only using the deleting cache in the predicted physics systems while #57 is the heavier approach. See the diff here: https://github.com/ashtonmeuser/PurrDiction/compare/cache-deleting..cache-deleting-2
I noticed this because of the following case:
onCollisionExitevent which, when fired, includes the GameObject with which RB#1 is no longer colliding.PredictionManager.hierarchy.Delete(rb2).onCollisionExitevent includesnullas the collider GO.This makes it very difficult to reason about RB contacts.
Need help on this PR? Tag
/codesmithwith what you need. Autofix is disabled.