It seems after updating to 1.42x there is a problem with removing gameObjects. Now when i pick up an item and remove it via interaction, the game pauses 1 second before it dissapears. I call an ActionList for this (remove hotspot, remove object, add inventory item) - I tried only to remove the object without calling the ActionList, same problem. Any Idea?
Thx!
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
Interaction-> ActionList : TakeItem (hotspot2Remove, gameObject2Remove, inventoryItem2Add)
The interacation 'UseMeasurteTape' calls 'TakeItem' (ActionList) with 3 params and 'TakeItem' will remove hotspot, object and add inventoyItem. This worked before.
Then i try to remove that object in the interaction directly, without calling the ActionList "TakeItem" and without removing hotspot and without adding inventory item. But the problem is the same. Making the object invisible works fine, only when i remove it it will hang 1-2 seconds.
Yes it is.
I'd suggest finding a way to delete them in one go. Try parenting each of the objects together, so that you can just delete the top-level object, and have them all removed at once.
I'm still suspicious that it's the re-evaluation function. Let's run a test: open up StateHandler.cs and comment out / remove all the lines inside the GatherObjects function - should start line 89.
before the object is deleted - ok i give it a try...
This causes a null reference exception. I comment out every line inside the GatherObject function.
Ok, i instanciate empty Arrays for them, then it worked. Now it's fast.
@UndyingSprite: This might be a bit tedius, but one (or possibly more) of those lines is the culprit. Try experimenting with original lines / empty arrays (i.e. just replace one empty at a time) and see if you can find which array in particular is causing the slowdown.
Hi Chris, figured out that it has nothing to do with the Arrays, the method : "IgnoreNavMeshCollision" causes the dealy.
First i thought the foreach Loop is the problem, but it's not.
The Problem is the if-Statement. I guess gettíng NavigationMesh or NavMeshSegment causes the Problem. I will check later which one of These is the culprit.
if (!_collider.isTrigger && !otherCollider.isTrigger && !(_collider is TerrainCollider) && _collider != otherCollider && (_collider.gameObject.GetComponent<NavigationMesh>() || _collider.gameObject.GetComponent<NavMeshSegment>()))
Yes, it is those two calls within the foreach in the if-statement:
_collider.gameObject.GetComponent<NavigationMesh>();
_collider.gameObject.GetComponent<NavMeshSegment>();
I may post a replacement function for you to test in a bit.