Skip to content

ArgumentOutOfRangeException when performing Drag and Drop Β #22

@marc-antoine-girard

Description

@marc-antoine-girard

Description

If a Component has at least one SerializableInterface<> as a field, dragging and dropping a GameObject on any other variable throws an ArgumentOutOfRangeException.

Example code

using System;
using TNRD;
using UnityEngine;

public class CodeExample : MonoBehaviour
{
    public SerializableInterface<IDog> AnInterface;
    public GameObject OtherVariable; // Could also be a Component
}

public interface IDog { }

[Serializable]
public class Dog : IDog
{
    public int age;
    public GameObject face;
}

Test performed

  1. Dragging and dropping any GameObject/Component on OtherVariable throws ArgumentOutOfRangeException.
  2. Removing AnInterface and doing step 1 won't throw error.
  3. Dragging and dropping any GameObject/Component on a sibling Component that doesn't contain a SerializableInterface won't throw.
  4. If AnInterface is assigned an instance of Dog, dragging and dropping any GameObject/Component on the Dog's face variable won't throw an error

Stacktrace

The relevant part...

TNRD.Drawers.ReferenceDrawer.HandleDragPerform () (at Assets/Unity3D-SerializableInterface/Editor/Drawers/ReferenceDrawer.cs:196)
TNRD.Drawers.ReferenceDrawer.HandleDragAndDrop (UnityEngine.Rect position) (at Assets/Unity3D-SerializableInterface/Editor/Drawers/ReferenceDrawer.cs:114)
TNRD.Drawers.RawReferenceDrawer.OnGUI (UnityEngine.Rect position) (at Assets/Unity3D-SerializableInterface/Editor/Drawers/RawReferenceDrawer.cs:73)
TNRD.SerializableInterfacePropertyDrawer.OnGUI (UnityEngine.Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label) (at Assets/Unity3D-SerializableInterface/Editor/SerializableInterfacePropertyDrawer.cs:48)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions