Hello Guest

Author Topic: Resizing tk2dsprite with a collider 2D makes spam logs  (Read 6540 times)

jerydarkside

  • Newbie
  • *
  • Posts: 2
    • View Profile
Resizing tk2dsprite with a collider 2D makes spam logs
« on: August 08, 2014, 11:02:43 pm »
Hi, using unity 4.5.2 and 2d Toolkit 2.4.0 :
When I create a tk2d Sprite, and add a Collider 2d (changing the physics engine in the settings of the sprite collection), if I resize the sprite (either using theSprite Controls in the scene, or changing the scale of the tk2dSprite script in the inspector), there are multiple error logs (repeating 999+) that appear in the console. These logs are :

*****************************
MissingReferenceException: The object of type 'BoxCollider2D' 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.
UnityEditor.Editor.IsEnabled ()
UnityEditor.InspectorWindow.DrawEditor (UnityEditor.Editor editor, Int32 editorIndex, Boolean forceDirty, System.Boolean& showImportedObjectBarNext, UnityEngine.Rect& importedObjectBarRect, Boolean eyeDropperDirty)
UnityEditor.InspectorWindow.DrawEditors (UnityEditor.Editor[] editors)
UnityEditor.InspectorWindow.OnGUI ()
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
*****************************
And
The targets array should not be used inside OnSceneGUI or OnPreviewGUI. Use the single target property instead.
UnityEditor.MaterialEditor:OnEnable()
**********
And
The serializedObject should not be used inside OnSceneGUI or OnPreviewGUI. Use the target property directly instead.
UnityEditor.BoxCollider2DEditor:OnEnable()


Do you have the same problem too?
I will make a video to illustrate my problem.
If you have any advice to help ;)

Sincerely,

Jery

jerydarkside

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Resizing tk2dsprite with a collider 2D makes spam logs
« Reply #1 on: August 08, 2014, 11:38:22 pm »
To illustrate the problem, here is the video I made about it
http://youtu.be/B6jvS4e4vcE?t=4m30s

At 4:30

Sincerely,

Jery

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Resizing tk2dsprite with a collider 2D makes spam logs
« Reply #2 on: August 10, 2014, 12:26:41 pm »
Hi,
This seems to be new behaviour in Unity from what I can tell - whats happening is the unity inspector code is holding on to a reference to the boxcollider, but when the sprite is resized, it deletes all attached colliders and recreates them. I have changed it that it doesn't do that any more and the messages are gone. They are otherwise harmless though - a fix will be in the next version.

mangoocean

  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: Resizing tk2dsprite with a collider 2D makes spam logs
« Reply #3 on: September 21, 2014, 02:07:55 pm »
I have an issue that i think might be the same?

Every time I press play, my active objects in the scene that have 2d Box colliders LOSE all of their colliders.

NullReferenceException: (null)
UnityEditor.SerializedObject..ctor (UnityEngine.Object[] objs)
UnityEditor.Editor.GetSerializedObjectInternal ()
UnityEditor.Editor.get_serializedObject ()
UnityEditor.Collider2DEditorBase.OnEnable ()

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Resizing tk2dsprite with a collider 2D makes spam logs
« Reply #4 on: September 22, 2014, 10:34:52 am »
I don't think thats the same behaviour. Can you create a minimal repro for this? The other issue is simply to do with spamming the error logs due to recreating the objects in the editor.