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?