当前位置:网站首页>Unity: the referenced script (unknown) on this behavior is missing“

Unity: the referenced script (unknown) on this behavior is missing“

2022-06-26 21:56:00 Peter_ Gao_

 

  Sometimes , When I started the game , I will receive a meaningless warning . I don't know where they come from , I don't have any objects to handle scripts that don't exist . How to delete or repair these messages ?

When I right-click the file icon in the inspector , I got two possible options . They don't work , Or when I try to click on them , No reaction .

5

It happens when the file and the name class has not the same name.

Example:

  • The file is named SingleCube.cs
  • The class definition is public class Cube : MonoBehaviour

In this case, Unity is not able to link the file and the class. Both have to have the same name.

  • The file should be SingleCube.cs
  • And the class definition public class SingleCube : MonoBehaviour

  When files and name The names of classes are different , That's what happens . Example : The file is called SingleCube.cs Class is defined as a public class Cube : MonoBehavior under these circumstances ,Unity Cannot link file and class . Both must have the same name . The document should be SingleCube.cs And classes define public classes SingleCube: MonoBehaviour

 unity3d - Unity: "The referenced script (Unknown) on this Behaviour is missing!" - Stack Overflow

 

Remove the missing script from the prefab , Remount the script .

原网站

版权声明
本文为[Peter_ Gao_]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/177/202206262154090011.html