- Home /
Script Reference Problem...
Hello everyone!
I am recently getting an error telling me a script reference is missing. Normally when those appear is when I've removed a script that was attached to an object. And Unity guides me to that object quite well.
However recently I have gotten the same message but without a reference in the console. The message that displays says
And it does this about 60 times in the console. After all of those messages I get 2 messages sayingThe referenced script (Unknown) on this Behaviour is missing!
No script asset for GameObjectSelectionItem. Check that the definition is in a file of the same name.
I have gone through every single object in my scenes, and every single prefab in my folders. Yet I can't find it anywhere, where a script is missing. What I did notice however! Was that this only occured to me while in playmode. And only if I had switched my target from Windows to Android. And I need it to be on android because that's where this game is going.
So why do I only get this message on Android as target. And not as Windows? How do I solve it?
Thanks a lot!
Not sure how complex your project is, but as a starter, if the issue only happens when you run android, I'd search for the definitions of "#if UNITY_ANDROID", you possibly have some definition missing when using it.
Hi, you may attach a script to a gameobject(prefab,scene objects) and some how you delete the script so object cant find the attached script. also it can be a bug of VS , restarting project may solve error.
Answer by misher · Sep 10, 2018 at 02:17 PM
One of you monobehaviour classes may have different name as their file name. Check all filenames to be exactly the same as your monobehaviour class names. Also there may be a bug with solution. Remove all .sln files from you project and reopen Visual Studio.
EDIT: Check all scenes if they contain gameobjects with missing references/ deleted scripts
Thanks for responding! I tried the things you told me to do just now and I'm still getting the error. I went through every single script that I have created meaning (not going through the Unity Ads SD$$anonymous$$s scripts). Since I haven't touched them. And also removed all the scripts that arent even being used in the game. Also removed the .sln files I could find.
Again I'm getting the same errors :/ But I'm still very curious as to why I get these errors when I change the Platform to Android ins$$anonymous$$d of Windows. I think that's so weird. Why would I get an error like that just by switching platform?
Anyways, I tried building the game anyways and I put it on my phone. And there is a difference with the build and the Unity Editor.
In the Unity Editor when this error appears the game freezes for a second or so. Then it displays the errors.
On the build on my phone it doesnt freeze or anything and it seems to be working just fine. But I'd really like not to have any errors nonetheless haha.
Thanks for your time! :) Really appreciated.
Can you paste GameObjectSelectionItem.cs here?
Yeah... For some reason that file doesn't exist..
The script may be in some third party plugin you use for android...
Hmmm :/ $$anonymous$$aybe you're right that doesnt sound completely far fetched haha. Thank you! I'm gonna keep digging though to see what I can find.
Your answer
Follow this Question
Related Questions
Android Build 0 Answers
Android - Failed to repackage resources error after installing facebook plugin 2 Answers
I have a build problem android. 0 Answers
Gradle Build Failed Unity version 2020..3.23 1 Answer
Android gradle build error 0 Answers