我从这段代码中收到NullReference
异常错误。我正在尝试从Current_AP
脚本访问值PM = PlayerMotor
,从Previous_Quest_Finished
脚本访问nars = nurse_npc
。任何帮助将不胜感激。
public nurse_npc nars; //drag and dropped gameobject named nurse
public byte QuestCompleted(byte check)
{
PlayerMotor pm;
pm = transform.GetComponent<PlayerMotor> ();
if(check == 0)
{
iscompleted = false;
//quest is pending
}
if(check == 1)
{
iscompleted = true;
onquest = false;
pm.Current_AP(10);
nars.Previous_Quest_Finished(1);
}
return check;
}