Search Issue Tracker

Fixed in 2019.3

Votes

11

Found in

2018.3.0b5

Issue ID

1090438

Regression

No

Edit Collider needs to be clicked every time after making any small change to the collider when editing in the Prefab mode

Physics2D

-

How to reproduce:
1. Open the attached project
2. Double click a prefab "Object" in the Project window to enter the Prefab mode
3. Go to Inspector window -> Polygon Collider 2D -> select Edit Collider
4. Edit collider in the Scene view

Expected: Edit Collider selection allows multiple changes to the collider
Actual: Edit Collider needs to be clicked every time after making any small change to the collider

Reproduced on: 2018.2.0x-Improved Prefabs, 2018.3.0b6, 2019.1.0a5

Note: Couldn't test on earlier versions because the feature was introduced in 2018.3

Comments (8)

  1. E55227e8a1fe3f72fb1361d778e4d972?d=mm

    Lucas_RUST

    Sep 10, 2019 21:30

    Seems to still be present in 2019.2.4f1

  2. Da740e9151f01c38d4bd89d4069211b3?d=mm

    Erwin-j

    Aug 15, 2019 18:59

    This seems not to be fixed.
    At least not for me.
    Using Unity 2019.2.0f.

  3. 36d2d4c188b6ba9ce50d848a072ca27f?d=mm

    sssetz

    Jun 26, 2019 18:47

    If you turn off "Auto Save" this doesnt happen.

  4. F490470d9d42c7e9dfc4c96a6b829088?d=mm

    unity_ikNl322_Itv0uw

    May 08, 2019 05:29

    I am excited to play the free game and this http://solitairetimes.com game has been upgraded and it is the best way to know this all the important quotes have been seen in this game i am so excited to see this type of windows game.

  5. E313ed1c4785815a165b3bb2786511c4?d=mm

    wallazz

    Apr 07, 2019 01:12

    Is there any way to edit comments? xD
    My solution below requires LinQ, null propagation

  6. E313ed1c4785815a165b3bb2786511c4?d=mm

    wallazz

    Apr 07, 2019 01:11

    Here's an edited version that works with polygoncollider2d. It seems that PolygonCollider2DEditor has to be set to edit mode in the next "frame" rather than when its exit mode ended.

    [InitializeOnLoadMethod]
    public static void InitLoad()
    {
    EditMode.onEditModeEndDelegate -= Collider2DEditModeFixer;
    EditMode.onEditModeEndDelegate += Collider2DEditModeFixer;
    }

    static void Collider2DEditModeFixer(Editor editor)
    {
    if (EditMode.editMode == EditMode.SceneViewEditMode.Collider || EditMode.IsOwner(editor)) return;

    var sel = Selection.activeGameObject;
    var cols = sel?.GetComponents<Collider2D>();
    if (cols == null || cols.Length == 0) return;

    var t = editor.target as Collider2D;
    if (t != null && (cols?.Contains(t) ?? false))
    {
    EditorApplication.delayCall += () => EditMode.ChangeEditMode(EditMode.SceneViewEditMode.Collider, t.bounds, editor);
    }
    }

  7. E313ed1c4785815a165b3bb2786511c4?d=mm

    wallazz

    Apr 07, 2019 00:48

    I created an automated fix for this. Sometimes i have multiple colliders in the same object so choosing just the first editor to edit won't work.
    The only downside is that if you want to exit the collider edit mode you have to select another object.

    [InitializeOnLoadMethod]
    public static void InitLoad()
    {
    EditMode.onEditModeEndDelegate -= Collider2DEditModeFixer;
    EditMode.onEditModeEndDelegate += Collider2DEditModeFixer;
    }

    static void Collider2DEditModeFixer(Editor editor)
    {
    var sel = Selection.activeGameObject;
    var cols = sel?.GetComponents<Collider2D>();

    var t = editor.target as Collider2D;
    if (t != null && cols.Contains(t))
    {
    EditMode.ChangeEditMode(EditMode.SceneViewEditMode.Collider, t.bounds, editor);
    }
    }

  8. 7e323af8e5f725c8d2e4c1c29ccd4fcd?d=mm

    NecroJack

    Apr 02, 2019 13:10

    I guess you do know the workaround, but anyways: editing an GameObject's collider in the scene, will not quit "Edit Collider" mode.

    Also, I composed a plugin/Script for working in Prefab Editor, (works by hitting Shift+E on every change... xD .. better than nothing!), with some code I found in stack-overflow :

    ----------------------------------
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using UnityEditor;

    public class MenuItems
    {
    [MenuItem("BugFixes/Edit Collider Mode #_e")] // This is Shift + e
    private static void EditCollider()
    {
    var sel = Selection.activeGameObject; if(!sel) return;
    var col = sel.GetComponent<Collider2D>(); if (!col) return;

    if (UnityEditorInternal.EditMode.editMode == UnityEditorInternal.EditMode.SceneViewEditMode.Collider)
    UnityEditorInternal.EditMode.ChangeEditMode(UnityEditorInternal.EditMode.SceneViewEditMode.None, new Bounds(), null);
    else
    {
    System.Type colliderEditorBase = System.Type.GetType("UnityEditor.ColliderEditorBase,UnityEditor.dll");
    Editor[] colliderEditors = Resources.FindObjectsOfTypeAll(colliderEditorBase) as Editor[];

    if (colliderEditors == null || colliderEditors.Length <= 0) return;

    UnityEditorInternal.EditMode.ChangeEditMode(UnityEditorInternal.EditMode.SceneViewEditMode.Collider, col.bounds, colliderEditors[0]);
    }
    Debug.Log("EditMode: " + UnityEditorInternal.EditMode.editMode);
    }
    }
    ----------------------------------

    The link from which I found most of the code (ready) is this one:
    https://forum.unity.com/threads/creating-a-hotkey-to-get-into-edit-collider-mode.474706/
    So, most credits go to him.

    P.S.: "Place in a folder called 'Editor' in order to work as a plugin", that's what I did, and it worked.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.