2
« on: November 25, 2013, 09:42:25 pm »
Hey I have been started to get an error message since I updated to unity 4.3. I get the error message several times when I enter play mode/exit play mode. The error message is:
Destroying object multiple times. Don't use DestroyImmediate on the same object in OnDisable or OnDestroy.
UnityEngine.Object:DestroyImmediate(Object)
tk2dUtil:DestroyImmediate(Object) (at Assets/TK2DROOT/tk2d/Code/tk2dUtil.cs:50)
tk2dRuntime.TileMap.SpriteChunk:DestroyColliderData(tk2dTileMap) (at Assets/TK2DROOT/tk2dTileMap/Code/tk2dTileMapChunks.cs:68)
tk2dRuntime.TileMap.Layer:DestroyGameData(tk2dTileMap) (at Assets/TK2DROOT/tk2dTileMap/Code/tk2dTileMapChunks.cs:404)
tk2dTileMap:OnDestroy() (at Assets/TK2DROOT/tk2dTileMap/Code/tk2dTileMap.cs:146)
The code looks like this:
public static void DestroyImmediate( UnityEngine.Object obj ) {
if (obj == null) {
return;
}
#if UNITY_EDITOR && !(UNITY_3_5 || UNITY_4_0 || UNITY_4_0_1 || UNITY_4_1 || UNITY_4_2)
if (!Application.isPlaying && undoEnabled) {
UnityEditor.Undo.DestroyObjectImmediate(obj);
}
else
#endif
{
UnityEngine.Object.DestroyImmediate(obj);
}
}
Do you have any suggestion about what I can do to get rid of the error message?
Thanks //Oscar