unity没办法用拖拽进行赋值,我要怎么做?

img


学做愤怒的小鸟,最大距离没法实现,报以下错误:UnassignedReferenceException: The variable RightPos of pig has not been assigned.
You probably need to assign the RightPos variable of the pig script in the inspector.

报这个错时因为你的截图没有赋值,不能被赋值时因为你这个脚本没有挂载到游戏物体上。

解决方法:把这个脚本挂载到游戏物体上,操作步骤如下所示:

img

img

https://blog.csdn.net/lovetaozibaby/article/details/119941146 【望采纳】