Dhoren Posted October 20, 2017 Report Posted October 20, 2017 Not a huge deal but I'm curious: In the UMAPropertyHandler in the ObjectNodeReady() method the property handlers are being registered. If when an "other" player exits the world are the current players registered object property change handlers automatically unregistered for the "other" player? or is there a way to detect that the "other" player exited so that I can unregister the handlers myself? I'm just wondering if I have registered property handlers that are accumulating and never getting unregistered. I can see a message on the Editor console "Removing Node for , OID " but in the UMAPropertyHandler I don't know how to catch that. Thanks Quote
Dhoren Posted October 21, 2017 Author Report Posted October 21, 2017 I'm not sure if it needed to be done but this is how I ended up doing it in the UMAPropertyHandler: // Use this for initialization void Start() { SceneManager.sceneLoaded += SceneLoaded; ClientAPI.WorldManager.ObjectRemoved += WorldManager_ObjectRemoved; } private void WorldManager_ObjectRemoved(object sender, AtavismObjectNode objNode) { if (objNode.Oid == GetComponent().Oid) { Debug.Log("****************************************************atavismNode needs to be removed for: " + GetComponent().GetComponent().name); GetComponent().RemoveObjectPropertyChangeHandler("beltDisplayID", EquipmentChangeHandler); GetComponent().RemoveObjectPropertyChangeHandler("capeDisplayID", EquipmentChangeHandler); GetComponent().RemoveObjectPropertyChangeHandler("chestDisplayID", EquipmentChangeHandler); GetComponent().RemoveObjectPropertyChangeHandler("feetDisplayID", EquipmentChangeHandler); GetComponent().RemoveObjectPropertyChangeHandler("handDisplayID", EquipmentChangeHandler); GetComponent().RemoveObjectPropertyChangeHandler("headDisplayID", EquipmentChangeHandler); GetComponent().RemoveObjectPropertyChangeHandler("legDisplayID", EquipmentChangeHandler); GetComponent().RemoveObjectPropertyChangeHandler("shoulderDisplayID", EquipmentChangeHandler); GetComponent().RemoveObjectPropertyChangeHandler("umaData", UmaDataHandler); } } Quote
Dhoren Posted October 21, 2017 Author Report Posted October 21, 2017 This is for my modified UMAPropertyHandler for my attempt at implementing UMA2.5 so it would need to be modified if you are not using UMA2.5. The reason I did this is because I suspect that registered events are not being unregistered when a player exits the game. Quote
sooms Posted October 24, 2017 Report Posted October 24, 2017 An OnDestroy() function also does the trick. That runs when the object is destroyed so I generally put my remove handler calls in there. Quote
Dhoren Posted October 24, 2017 Author Report Posted October 24, 2017 Wow that's great thanks. I'll give that a try. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.