以下の内容はhttps://baba-s.hatenablog.com/entry/2021/11/10/091000より取得しました。


【Unity】You are trying to replace or create a Prefab from the instance 'XXXX' that contains the script 'YYYY', which does not derive from MonoBehaviour. This is not allowed.

概要

f:id:baba_s:20211110091505p:plain

Saving failed. Check the Console window to get more 
insight into what needs to be fixed.

プレハブを編集して保存する時に上記のエラーダイアログが表示されて

You are trying to replace or create a Prefab from the instance 'XXXX' 
that contains the script 'YYYY', which does not derive from MonoBehaviour. 
This is not allowed.
Please change the script to derive from MonoBehaviour or remove it 
from the GameObject.
UnityEditor.EditorApplication:Internal_CallGlobalEventHandler ()

Console ウィンドウにこのようなエラーメッセージが表示される場合は

f:id:baba_s:20211110092622p:plain

プレハブに含まれているゲームオブジェクトに
MonoBehaviour を継承していないクラスのスクリプトがアタッチされている可能性があるため

f:id:baba_s:20211110092650p:plain

MonoBehaviour を継承するように修正するか、

f:id:baba_s:20211110092945p:plain

もしくはそのスクリプトをゲームオブジェクトから Remove Component すれば
プレハブを保存できるようになります




以上の内容はhttps://baba-s.hatenablog.com/entry/2021/11/10/091000より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14