Unity “The associated script can not be loaded” and “Win32Exception: The system cannot find the file specified”

前端 未结 4 479
-上瘾入骨i
-上瘾入骨i 2021-01-07 08:29

so I\'m new to Unity and I\'ve been trying to test the scene with the script attatched to a character. However, it keeps saying \"The associated script cannot be loaded. Ple

相关标签:
4条回答
  • 2021-01-07 09:07

    It's basically because you deleted some script or renamed it or degraded unity version. you might have to reassign the script at the required position/component.

    Note: Make sure that class name is the same as the script name in unity.

    0 讨论(0)
  • 2021-01-07 09:10

    I think your class name is different from file name.

    0 讨论(0)
  • 2021-01-07 09:23

    First, it is recommended to use "Add component" to create a script, if you want to attach it to a GameObject, as it automatically imports necessary libraries. Implementing MonoBehaviour is necessary for adding a script to a GameObject.

    Second, FixedUpdate() should not be set to private, it does not need an access modifier, just like Start(), see https://docs.unity3d.com/ScriptReference/MonoBehaviour.FixedUpdate.html.

    Third, the errors in your first screenshot seem to imply that there is a problem with your Unity installation. Try reinstalling it and make sure that the Editor you install matches your operating system (64 or 32 bit?).

    Fourth, the second screenshot is shown when you use any obsolete libraries or classes, which does not seem to be the case in the script you shared.

    Hope that helps.

    0 讨论(0)
  • 2021-01-07 09:24

    Unity apparently can't handle apostrophes (single-quote ') in the directory name of the editor. You need to get rid of the apostrophe in your directory name. Once you make that change, Unity should be able to build the scripts as intended.

    0 讨论(0)
提交回复
热议问题