Не могу скрипт прикрепить к персонажу
Как прикрепить камеру View к персонажу
Может заезженный вопрос,посмотрел видео,но там везде используются классы,со сложными структурами и.

Как прикрепить скрипт на кнопку?
Вообщем, не могу привязать к кнопке скрипт, везде, во всех видео и гайдах, написано что нужно.

Прикрепить скрипт к динамическому ХТМЛ
Есть такая функция function modalToCreateDocument(container)< // init vars var item, obj.
Как прикрепить данный скрипт в битрикс?
хочу установить на сайте вот этот компонент.. куда файлы нужно кинуть.
Can’t add script component because the script class cannot be found
Try these: 1. Check if the name of the file is same as the class name or not. The class that associates with Monobehaviour must be same as the file name. 2. Check for any errors in your script 3. Bad import. In that case just right click your mouse in the project folders section and select Reimport All option.
Top comments (0)
For further actions, you may consider blocking this person and/or reporting abuse
проблема с unity. ошибка: Can’t add script
ошибка: Can’t add script component ‘Player’ because the script
dass cannot be found. Make sure that there are no
compile errors and that the file name and class name
match.
также пробовал новый скрипт но он тоже не хочет работать
Дополнен 4 года назад
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerController : MonoBehaviour
// Start is called before the first frame update
void Start()
// Update is called once per frame
void Update()
Лучший ответ
В Unity обязательное требование, чтобы имя файла скрипта было точно
таким же, как имя главного класса в скрипте.
Проверьте совпадают ли у вас эти имена.
В скрипте у вас имя главного класса PlayerController, а файл скрипта
наверное имеет другое название.
На фото пример (как должно быть) с именем KEY.
Can’t add script component because the script class cannot be found?
Yesterday I updated unity from unity5 to 2018.2.2f1. Unity scripts are not loading after Update 2018.2.2f1. Once I try to play the Scene the scripts are not loaded and I can’t add the script again it gives this error:
Can’t add script component ‘CubeScript’ because the script class cannot be found. Make sure that there are no compile errors and that the file name and class name match.

123k 22 22 gold badges 240 240 silver badges 331 331 bronze badges
asked Aug 6, 2018 at 18:18
919 3 3 gold badges 15 15 silver badges 37 37 bronze badges
unity5 to 2018.2.2f1 is a big jump. It would have been better to do unity5 to 2017 then 2018.2.2f1 to reduce the chances of issues arising in the updated project. Where is the «CubeScript» placed in your project?
Aug 6, 2018 at 18:24
@Programmer It is in my assets in a folder _scripts and I opened it from the assets and the script opens as usual in monodevelop.
Aug 6, 2018 at 18:26
There is a floder Packages next to Assets do I have to do something with it? @Programmer
Aug 6, 2018 at 18:30
That is totally not professional I want another solution
Aug 6, 2018 at 18:41
My Project Is so big and i can’t go to every folder and do that manually is there any way better than this
Aug 6, 2018 at 19:01
13 Answers 13
If you still have the old copy of the project, upgrade the Unity project to Unity 2017 first then to 2018.2.2f1.
Here are the few possible reasons you may get this error(Ordered from very likely)
1.Script name does not match class name.
If script name is called MyClass , the class name must be MyClass . This is also case-sensitive. Double check to make sure that this is not the issue. To make sure that’s not the issue, copy the class name and paste it as the script name to make sure that this is not the issue.
Note that if you have have multiple classes in one script, the class name that should match with the script name is the class that derives from MonoBehaviour .
2.There is an error in your script. Since this is an upgrade, there is a chance you’re using an API that is now deprecated and removed. Open your script with Visual Studio and see if there is an error there then fix it. There is usually a red line under a code that indicates there is an error.
3.Bad import with the Unity importer and its automatic upgrade script.
A.The first thing to do is restart the Unity Editor.
B.Right click on the Project Tab then click «Reimport All»
C.If there is still issue, the only left is deleting the problematic script and creating a new one. There is an easier way to do this if the script is attached to many GameObjects in your scene.
A.Open the script, copy its content into notepad.
B.From the Editor and on the Project tab right click on the script «CubeScript», select «Find References In Scene».
C.Unity will now only show all the GameObjects that has this script attached to them. Delete the old script. Create a new one then copy the content from the notepad to this new script. Now, you can just drag the new script to all the filtered GameObject in the scene. Do this for every script effected. This is a manual work but should fix your issues when completed.