Skip to content
This repository has been archived by the owner on Jul 30, 2020. It is now read-only.

2d char array Exception on Inspector #14

Closed
XScorpion2 opened this issue Feb 22, 2014 · 1 comment
Closed

2d char array Exception on Inspector #14

XScorpion2 opened this issue Feb 22, 2014 · 1 comment

Comments

@XScorpion2
Copy link

Building a 2d char array at runtime and then select the object after awake has been called.

Example Class:

using UnityEngine;
using FullInspector;
using Newtonsoft.Json;

[JsonObject(MemberSerialization.OptIn)]
public class CharTest : BaseBehavior
{
    public int sizeX;
    public int sizeY;
    public char[,] grid;

    protected override void Awake()
    {
        base.Awake();
        grid = new char[sizeX, sizeY];
    }
}

Exception Details:

InvalidCastException: Cannot cast from source type to destination type.
FullInspector.PropertyEditor`1[System.Char[]].FullInspector.IPropertyEditor.GetElementHeight (UnityEngine.GUIContent label, System.Object element) (at Assets/FullInspector/FullInspector/Editor/IPropertyEditor.cs:65)
FullInspector.PropertyEditors.ReflectedPropertyEditor.GetElementHeight (UnityEngine.GUIContent label, System.Object element) (at Assets/FullInspector/FullInspector/Editor/PropertyEditors/Special/ReflectedPropertyEditor.cs:223)
FullInspector.FullInspectorCommonSerializedObjectEditor.OnInspectorGUI () (at Assets/FullInspector/FullInspector/Editor/FullInspectorCommonSerializedObjectEditor.cs:63)
UnityEditor.DockArea:OnGUI()
@jacobdufault
Copy link
Owner

For the moment, you can use char[][] instead of char[,]. I'll look into adding multidimensional array support (it looks like 1.3 will be the most likely release). See issue #16.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants