Search Unity

"Script attached to ... in scene ... is missing or no valid script is attached errors" on iOS

Discussion in 'Unity Build Automation' started by rockyourteeth, Dec 9, 2015.

  1. rockyourteeth

    rockyourteeth

    Joined:
    Jul 25, 2013
    Posts:
    17
    I can build for Android fine, and play the game in Editor fine, but when I build for iOS, I get these errors. The build completes, and the game launches, but the game doesn't play.

    I've double and triple checked my level setup and everything is referenced fine. I've scoured other forums and haven't found the answer. Attaching full log. Thanks for any help. I've lost so much sleep over this over the past couple of days... :/
     

    Attached Files:

  2. Deleted User

    Deleted User

    Guest

    I have had this problem before. Did you commit your .meta files too? You need them.
     
  3. dannyd

    dannyd

    Unity Technologies

    Joined:
    Jun 3, 2014
    Posts:
    785
  4. rockyourteeth

    rockyourteeth

    Joined:
    Jul 25, 2013
    Posts:
    17
    Thank you for that link, I learned a lot about meta files.

    However, I can't seem to find my problem. I've got all of my meta files checked in (github). Is there any way to reconcile all the guids in all the meta files to see if they're all pointing at the right things? Although, it seems like they must be correct considering the game runs fine on Android (local deploy) and in-editor.

    You're definitely right about what I'm checking into source control being a suspect, though, since cloud build is the only one of my builds that is pulling exclusively from Github...

    Oh, oh, maybe this is the problem! Here's my gitignore file:

    Code (CSharp):
    1. .dwlt
    2. *.dwlt
    3. *.sln
    4. *.sln
    5. *.csproj
    6. *.pidb
    7. .DS_Store
    8. Library/AssetImportState
    9. Library/AssetServerCacheV3
    10. Library/FailedAssetImports.txt
    11. Library/ScriptAssemblies
    12. Library/ScriptMapper
    13. Library/assetDatabase3
    14. Library/cache
    15. Library/expandedItems
    16. Library/metadata
    17. Library/previews
    18. Library/guidmapper
    19. Library/
    20. Library/*
    21. Temp
    22. *.userprefs
    I got that gitignore file from a friend because I didn't know what I was doing at the time, but now it looks like maybe that "guidmapper" or "metadata" folder might be something I need to check in.

    Thoughts? (I'm at work right now so I can't try it, but I'll confirm if it works for me)
     
    Last edited: Dec 9, 2015
  5. dannyd

    dannyd

    Unity Technologies

    Joined:
    Jun 3, 2014
    Posts:
    785
    One option here is to delete your /Library locally then re-open Unity (or just pull clone the repo to a new folder and open in Unity). This will cause everything to be re-imported so potentially VERY slow depending on the size of your project. At that point you should be in the same state as what UCB is seeing - so most likely you will have those broken references that need to be fixed up locally (and checked in).

    Also, you definitely don't want ANYTHING from /Library being checked in. The gitgnore I normally start with usually looks like:

    Code (CSharp):
    1. # Ignore misc OS files...
    2. .DS_Store
    3. .DS_Store?
    4. ._*
    5. .Spotlight-V100
    6. .Trashes
    7. ehthumbs.db
    8. Thumbs.db
    9.  
    10. # Ignore Unity artifacts
    11. Library
    12. Temp
    13. *.csproj
    14. *.pidb
    15. *.sln
    16. *.userprefs
     
  6. rockyourteeth

    rockyourteeth

    Joined:
    Jul 25, 2013
    Posts:
    17
    Thanks. I'll try that.
     
  7. rockyourteeth

    rockyourteeth

    Joined:
    Jul 25, 2013
    Posts:
    17
    Thank you, this has definitely led to the source of the problem! I pulled down my own repository on a different computer and loaded up the project, and sure enough, missing script references. After examining it, all of these scripts had the wrong casing. Thinking back, these are scripts that I created in one casing, and then changed mid-way though. (mainMenu.cs because MainMenu.cs, but had now reverted back to mainMenu.cs).

    I'll fix all these up (when I get home) and update this thread. Thanks!
     
  8. rockyourteeth

    rockyourteeth

    Joined:
    Jul 25, 2013
    Posts:
    17
    Okay, I got it all working and running.

    Final culprit: Github not being case sensitive! The scripts in Github were lower cased, and the files locally and in Unity were upper cased. My solution was to move the whole scripts folder out of the project, backup to Github so that it thought those files were deleted, and then re-add that whole folder, and re-added all those scripts with their correct casing.

    Whew! That's one way to blow half your week chasing down build errors! Thanks for the help.