Search Unity

unityeditor.dockarea:ongui() error

Discussion in 'Getting Started' started by Tarball, Oct 16, 2016.

  1. Tarball

    Tarball

    Joined:
    Oct 16, 2016
    Posts:
    166
    I'm totally new to Unity this weekend, and I'm getting a puzzling error that I can't find any relevant forum posts for or documentation on. My c# script that I'm using to try to create some simple animation is giving the following error:


    mono_object_isinst(value, elementClass)
    UnityEditor.DockArea:OnGUI()


    I set up my states in the animator like everybody says (with a trigger) and use the following script:

    using UnityEngine;
    using System.Collections;

    public class sword_thrust :MonoBehaviour
    {
    Animator thrust_anim;

    void Start()
    {
    thrust_anim = GetComponent<Animator>();
    }

    void Update()
    {
    if(Input.GetMouseButtonDown(0))
    {
    thrust_anim.SetTrigger("thrust");
    }
    }

    }

    What does this error mean and how does it relate to my situation? Is there some major mistake in my method(s)? By the way, I'm using the experimental Linux build 5.3.
     
  2. Bill_Martini

    Bill_Martini

    Joined:
    Apr 19, 2016
    Posts:
    445
    Can't tell you what that error means, but...

    You need to use code tags when posting any code. I makes it much easier for us to help.

    and replace this line;
    Code (csharp):
    1. Animator thrust_anim;
    with this line;
    Code (csharp):
    1. public Animator thrust_anim;
    then, in the editor select the object the script is on and drag your animator to empty slot labeled Thrust_anim in the script component.
     
  3. Bill_Martini

    Bill_Martini

    Joined:
    Apr 19, 2016
    Posts:
    445
    After rereading just change;

    Code (csharp):
    1.  private Animator thrust_anim;
    you're getting the animator in start.
    My suggestion above will also work but kill this line as you are supplying the Animator;
    Code (csharp):
    1. thrust_anim = GetComponent<Animator>();
     
  4. Tarball

    Tarball

    Joined:
    Oct 16, 2016
    Posts:
    166
    Thanks for the replies. I see what you mean. I don't need that part. Regarding your previous comment, I'm afraid I don't follow you. In the GUI, I have my animation state hooked up to an idle state both ways. I created a trigger (thrust) for the animation state which is linked to the c# script. Then, I set the motion field to my animation. Am I missing something? It seems the GUI is more complicated than the scripting. ha. I still have no clue about this error though. Until I figure it out, I can't link the script, so no animation.
     
  5. Bill_Martini

    Bill_Martini

    Joined:
    Apr 19, 2016
    Posts:
    445
    There is nothing in the code you provided that has to do with the UI. Your error is somewhere else. In most circumstances the complete error will provide a clue where to look. 'UnityEditor' in the error statement implies you have, or tried to mod the editor, look there.
     
  6. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    Or it implies that the bug is actually in Unity itself. This does happen on occasion, even in the Mac build, and I imagine the experimental Linux version is even more prone to this.
     
    Kiwasi likes this.
  7. natnie

    natnie

    Joined:
    Dec 18, 2016
    Posts:
    1
    I have been getting these two errors when I open one specific scene in my project:

    GetPixels32 failed: insufficent pixel buffer size (4), must be at least 4 x 4
    UnityEditor.DockArea:OnGUI()

    Failed to get pixels of splat texture
    UnityEditor.DockArea:OnGUI()

    I have a bunch of scenes, but only one throws these errors. I also seem to have a lot of problems with light baking in this scene. I wonder why??
     
  8. be49

    be49

    Joined:
    Sep 25, 2019
    Posts:
    1
    alguem ajuda com esse erro UnityEditor.DockArea:OnGUI()