keijiro/VJUI

TargetParameterCountException on Unity 2019

0m15 opened this issue · 4 comments

0m15 commented

Hi, I'm getting TargetParameterCountException: Number of parameters specified does not match the expected number.

Unity 2019.6f1.

Here is the full stacktrace:

TargetParameterCountException: Number of parameters specified does not match the expected number.
System.Reflection.MonoMethod.ConvertValues (System.Reflection.Binder binder, System.Object[] args, System.Reflection.ParameterInfo[] pinfo, System.Globalization.CultureInfo culture, System.Reflection.BindingFlags invokeAttr) (at <599589bf4ce248909b8a14cbe4a2034e>:0)
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <599589bf4ce248909b8a14cbe4a2034e>:0)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <599589bf4ce248909b8a14cbe4a2034e>:0)
Klak.VJUI.DefaultControls.CreateUIElementRoot (System.String name, UnityEngine.Vector2 size) (at Packages/jp.keijiro.klak.vjui/Editor/DefaultControls.cs:21)
Klak.VJUI.DefaultControls.CreateButton (UnityEngine.Sprite sprite, UnityEngine.Font font) (at Packages/jp.keijiro.klak.vjui/Editor/DefaultControls.cs:96)
Klak.VJUI.MenuOptions.AddButton (UnityEditor.MenuCommand menuCommand) (at Packages/jp.keijiro.klak.vjui/Editor/MenuOptions.cs:45)
UnityEditor.GenericMenu:CatchMenu(Object, String[], Int32)
0m15 commented

It seems I made it work by replacing the two methods CreateUIElementRoot and CreateUIObject in DefaultControls.cs with the following:

static GameObject CreateUIElementRoot(string name, Vector2 size)
{
    GameObject go = new GameObject(name);
    RectTransform rect = go.AddComponent<RectTransform> ();
    rect.sizeDelta = size; 
    return go;
}

static GameObject CreateUIObject(string name, GameObject parent)
{
    GameObject go = new GameObject(name);
    go.AddComponent<RectTransform>();
    go.transform.SetParent(parent.transform, false);
    return go;
}

Unity 2019.6f1.

Could you check the correct version number? There is no such version as 2019.6 -- It must be 2019.1.x, 2019.2.x or 2019.3.x.

0m15 commented

Fixed: 876a7be