Hello, I've following issue:
I've Player object with InventoryIdentifier component. I need to destroy player object later in game and spawn a new one.
When new Player is spawned I've got this error:
InvalidCastException: Specified cast is not valid.
Opsive.UltimateInventorySystem.Core.Registers.InventoryObjectIDOnlyRegister`1[T].AssignNewID (T obj) (at Assets/Opsive/UltimateInventorySystem/Scripts/Core/Registers/InventoryObjectRegister.cs:180)
Opsive.UltimateInventorySystem.Core.Registers.InventoryObjectIDOnlyRegister`1[T].RegisterInternal (T obj) (at Assets/Opsive/UltimateInventorySystem/Scripts/Core/Registers/InventoryObjectRegister.cs:243)
Opsive.UltimateInventorySystem.Core.Registers.InventoryObjectIDOnlyRegister`1[T].Register (T obj) (at Assets/Opsive/UltimateInventorySystem/Scripts/Core/Registers/InventoryObjectRegister.cs:225)
Opsive.UltimateInventorySystem.Core.InventoryCollections.InventoryIdentifier.Awake () (at Assets/Opsive/UltimateInventorySystem/Scripts/Core/InventoryCollections/InventoryIdentifier.cs:55)
UnityEngine.Object:Instantiate(Character, Vector3, Quaternion)
Probably I need to somehow unregister it before, but I am not sure how. Thanks for help
I've Player object with InventoryIdentifier component. I need to destroy player object later in game and spawn a new one.
When new Player is spawned I've got this error:
InvalidCastException: Specified cast is not valid.
Opsive.UltimateInventorySystem.Core.Registers.InventoryObjectIDOnlyRegister`1[T].AssignNewID (T obj) (at Assets/Opsive/UltimateInventorySystem/Scripts/Core/Registers/InventoryObjectRegister.cs:180)
Opsive.UltimateInventorySystem.Core.Registers.InventoryObjectIDOnlyRegister`1[T].RegisterInternal (T obj) (at Assets/Opsive/UltimateInventorySystem/Scripts/Core/Registers/InventoryObjectRegister.cs:243)
Opsive.UltimateInventorySystem.Core.Registers.InventoryObjectIDOnlyRegister`1[T].Register (T obj) (at Assets/Opsive/UltimateInventorySystem/Scripts/Core/Registers/InventoryObjectRegister.cs:225)
Opsive.UltimateInventorySystem.Core.InventoryCollections.InventoryIdentifier.Awake () (at Assets/Opsive/UltimateInventorySystem/Scripts/Core/InventoryCollections/InventoryIdentifier.cs:55)
UnityEngine.Object:Instantiate(Character, Vector3, Quaternion)
Probably I need to somehow unregister it before, but I am not sure how. Thanks for help