早教吧 育儿知识 作业答案 考试题库 百科 知识分享

unity对象引用没有设置为对象的一个实例NullReferenceException:ObjectreferencenotsettoaninstanceofanobjectNpc.OnGUI()(atAssets/Script/Npc.cs:73)Thereare2audiolistenersinthescene.Pleaseensurethereisalwaysexactlyo

题目详情
unity 对象引用没有设置为对象的一个实例
NullReferenceException:Object reference not set to an instance of an object
Npc.OnGUI () (at Assets/Script/Npc.cs:73)
There are 2 audio listeners in the scene.Please ensure there is always exactly one audio listener in the scene.
NullReferenceException:Object reference not set to an instance of an object
Script_08_16.Update () (at Assets/Script/Script_08_16.cs:24)
本人菜鸟,
▼优质解答
答案和解析
There are 2 audio listeners in the scene.Please ensure there is always exactly one audio listener in the scene.
表示你场景中有2个相机,并且有2个耳朵,这样系统无法确定将音频声音传递给哪个.你应该确保场景中,同时只有一个耳朵存在.(Audio Listenner)
NullReferenceException:Object reference not set to an instance of an object
是你在使用某具体对象的时候,该对象的值为空.请检查赋值