Fix 'Can't add script behaviour AssemblyInfo. The script needs to derive from..' - Unity

preview_player
Показать описание
// ENG
If you have encountered the following error:
"Can't add script behaviour AssemblyInfo. The script needs to derive from MonoBehaviour"
or you can't add the script with a simple drag and drop,
you have to make sure that the name of the script in unity and the name of the script in the script code are the same.

// ITA
Se avete riscontrato il seguente errore:
"Can't add script behaviour AssemblyInfo. The script needs to derive from MonoBehaviour"
oppure non riuscite ad aggiungere lo script con un semplice drag and drop,
dovete assicurarvi che il nome dello script in unity e il nome dello script nel codice dello script stesso, coincidano.
Рекомендации по теме
Комментарии
Автор

thank you so much bro!! it helped a lot

SARANGSJOSHI
Автор

Can you please help me? Im new to unity and i was watching a youtube tutorial about forcing NPC to follow the Player. Author's script was using "ScriptName : ScriptMachineBehaviour", instead of just "ScriptName : MonoBehaviour". So i just replaced ":MonoBehaviour" with ":ScriptMachineBehaviour". After that i noticed Unity gives me error:
"The script 'ScriptName' does not derive from MonoBehaviour, but has been added to Game Object 'NPC'. Please remove the script from the Game Object to avoid crashes."
So i guess you can't just replace default behaviour with another behaviour. Do you know how to create a script based on ScriptMachineBehaviour, not default MonoBehaviour?

goodgamershow
Автор

Hey! My script has this same error but hase the exact name word for word, I don't know why it still gives me the error
Monobehaviour was written correct, everything was written correct but it gave me the same error no matter what.

erinhenryadams
Автор

Basically, I downloaded the project and import it unity. When i use the script it give the same error as in your video("Can't add script behaviour PostProcessLayer. The script needs to derive from MonoBehaviour") I reimport the project, names are the same. can you help me plz?

adnanabid
Автор

Names are same, i make new script and then try it but still getting same error
"Can't add script behaviour PostProcessLayer. The script needs to derive from MonoBehaviour"

adnanabid
Автор

Can you please help. I had the same problem with all of my scrips, so unity told me update but when i did the whole thing was black so i just changed it back. But when i changed it back every thing like broke like all of my scrips are still there but unity thinks it’s missing and had the same error message. Please help

panicstar
welcome to shbcf.ru