Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Missing Ref Exception when deleting Obi Cloth
#2
(26-02-2021, 09:45 PM)fluidman84 Wrote: I've encountered this error when I attempt to Destroy() a obi cloth object in the scene that has been instantiated and then create a new obi cloth object in its place. This issue does not occur if I Destroy the object first then instantiate a new one afterward in a separate method, but I cannot perform the Destruction in the same method without receiving this error for the missing ObiSkinnedClothBlueprint. Is there a way I can disable this one the obi cloth to be destroyed to prevent this error?



Code:
MissingReferenceException: The object of type 'ObiSkinnedClothBlueprint' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
UnityEngine.Object.Instantiate[T] (T original) (at <fe84f4a754da4a6bb64fca409d40938a>:0)
Obi.ObiActor.StoreState () (at Assets/Obi/Scripts/Common/Actors/ObiActor.cs:1028)
Obi.ObiActor.UnloadBlueprint (Obi.ObiSolver solver) (at Assets/Obi/Scripts/Common/Actors/ObiActor.cs:1071)
Obi.ObiClothBase.UnloadBlueprint (Obi.ObiSolver solver) (at Assets/Obi/Scripts/Cloth/Actors/ObiClothBase.cs:179)
Obi.ObiSolver.RemoveActor (Obi.ObiActor actor) (at Assets/Obi/Scripts/Common/Solver/ObiSolver.cs:1114)
Obi.ObiActor.RemoveFromSolver () (at Assets/Obi/Scripts/Common/Actors/ObiActor.cs:326)
Obi.ObiActor.OnDisable () (at Assets/Obi/Scripts/Common/Actors/ObiActor.cs:292)
Obi.ObiSkinnedCloth.OnDisable () (at Assets/Obi/Scripts/Cloth/Actors/ObiSkinnedCloth.cs:123)
UnityEngine.Object:DestroyImmediate(Object, Boolean)
OutfitChanger_Fem:DeleteClothingItem() (at Assets/Scripts/OutfitChanger_Fem.cs:181)
OutfitChanger_Fem:LoadOutfitBundlePrefab(String) (at Assets/Scripts/OutfitChanger_Fem.cs:172)
UnityEngine.EventSystems.EventSystem:Update() (at C:/Program Files/Unity/Hub/Editor/2020.1.15f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/EventSystem.cs:376)

Hi, can you post the code that results in this error? keep in mind that Destroy() does not destroy the object immediately, it just marks it for destruction at the end of the frame. This can lead to subtle bugs.
Reply


Messages In This Thread
RE: Missing Ref Exception when deleting Obi Cloth - by josemendez - 27-02-2021, 10:02 AM