Internal Compiler error

hi i got a internal compiler error,

Internal compiler error. See the console log for more information. output was:
Unhandled Exception: Mono.CSharp.InternalErrorException: Assets/CalnanScripts/Calnan.cs(4,14): Calnan —> Mono.CSharp.InternalErrorException: Assets/CalnanScripts/Calnan.cs(89,10): Calnan.SetAnimation(Calnan.ProneState, ActState, MoveState) —> System.NullReferenceException: Object reference not set to an instance of an object

at Mono.CSharp.EnumMember.Define () [0x00000] in :0

at Mono.CSharp.TypeContainer.FindMembers (MemberTypes mt, BindingFlags bf, System.Reflection.MemberFilter filter, System.Object criteria) [0x00000] in :0

im wondering how i fix it. first time i got one. theres nothing wrong with my code. what could it be? has anyone else got these? i would usually put this in scipting but i saw “internal”. so is it my code or something inside the actual engine itself.

using UnityEngine;
using System.Collections;

public class Calnan : MonoBehaviour
{
    public Transform Camera;
    public Transform CamPoint;


    public string CurrentState;
    public enum ProneState
    {
      Null,     
      Idle,     
      Crouch,
      Standing,
     
    }
    public enum ActState
    {   Null,
         Fire,
         Jump,
         Aim
    }
    public enum MoveState
    {  Null,  
        Walk,
        Run,
        StrafeLeft,
        StrafeRight,
    }

    ProneState Prone;
    MoveState MoveDir;
    ActState Act;
    
    // Use this for initialization
    void Awake()
    {
        Prone = ProneState.Standing;
        Act = ActState.Null;

    }
    void Start()
    {
        animation.GetClip(ProneState.Idle.ToString());
        
        
       
    }

    // Update is called once per frame
    void Update()
    {
        animation.Play();
       
        CheckState();
        Camera.position = CamPoint.position;
    }
    void CheckState()
    {
        bool CrouchMode = false;

        if (Input.GetButton("Fire1"))
        {
            SetAnimation(ProneState.Null,ActState.Fire);
        }
        if (Input.GetButton("Crouch") )
        {
            if (!CrouchMode)
            {
                SetAnimation(ProneState.Crouch);
                Prone = ProneState.Crouch;
                CrouchMode = true;
            }
            CrouchMode = false;

        }
      
        else
        {
            SetAnimation(ProneState.Idle);
        }

      
 
    }
   
    void SetAnimation(ProneState prone = ProneState.Null, ActState Action = ActState.Null, MoveState Move = MoveState.Null )
    {
        if (prone == ProneState.Null)
        {
            prone = Prone;
        }
        if (Action == ActState.Null)
        {
            Action = Act;
        }
        if (Move == MoveState.Null)
        {
            Move = MoveDir;
        }

        string newAnim1 = prone.ToString();
        string newAnim2 = Action.ToString();
        string newAnim3 = Move.ToString();

        string newAnim = newAnim1 + newAnim3 + newAnim2;
        animation.clip = animation.GetClip(newAnim);
        CurrentState = newAnim;

    }
}

has anyone else ever got an error like this?

with some debugging, Unity Apparently doesn’t support Optional Parameters that are enums, why? it should do. cause if i use them no errors appear only that one. is this a bug worth submitting?

void SetAnimation(ProneState prone = ProneState.Null, ActState Action = ActState.Null, MoveState Move = MoveState.Null )

this function call was the source of the problem, as soon as i removed them from being optional. and compiled the to Unity. the Error was gone. But Visual studio had no trouble with its “Real-time Compiler”. why is this? it makes no sense…

Thank you so much for posting this!! I was tearing my hair out over this compile time error which popped up when I changed

    public void display ( int left, int top, ArcoPlayer player, ArcoPlayer enemy, bool playable = true, 
        bool canPay = true, bool selectFrame = false,  string textOver = "" )

to this:

    public void display ( int left, int top, ArcoPlayer player, ArcoPlayer enemy, bool playable = true, 
        bool canPay = true, selectFrame highlight=ArcoCard.selectFrame.none,  string textOver = "" )

I spent a lot of time searching Unity answers to no avail, removing the default value from highlight fixed my compile error. As a complete unity noob I don’t know how to request this, but it seems like something that the Unity folks should either fix, or put in their documents as a limitation.

Just like to thank you again - sometimes I think people feel they are talking to themselves when they post some tech issue they solved, but you helped me (and I bet others too)!

I just confirmed, after pulling my last few hairs out, that this is still a bug. Thank God for these forums, I was about to start an arduous binary search of all my code changes over the past hour to figure out what caused everything to just stop working.