问答详情
源自:2-4 Unity3D的常用方法

unity报错:NullReferenceException: Object reference not set to an instance of an object CreatObject.Start () (at Assets/CreatObject.cs:25)

unity报错:NullReferenceException: Object reference not set to an instance of an object
CreatObject.Start () (at Assets/CreatObject.cs:25)
脚本25行:transLight.GetComponent<Light>().color = Color.green;

提问者:慕用2450088 2016-12-27 16:46

个回答

  • 慕粉2155091259
    2018-07-17 08:43:44

    同问,我只有一个灯变了颜色,还报错

  • Yobr
    2016-12-29 17:14:44

    程序格式没错

  • Yobr
    2016-12-29 17:09:05

    没有获取到,具体的要看你的project,建议你看下慕课U3D脚本入门2-4.有兴趣玩U3D游戏引擎加我好友一起讨论啊,我也是最近才学习