Search Unity

Bug Broken script references on updating custom package through package manager and committing it to git

Discussion in 'Package Manager' started by Gentlymad, Feb 28, 2023.

  1. Gentlymad

    Gentlymad

    Joined:
    Nov 11, 2014
    Posts:
    16
    Hello there,

    In our current project we are working with custom packages hosted on github. One of the packages, which is some kind of framework for our UI, regularly causes problems.

    When the corresponding package is updated on github, we of course also update it in our main project via the package manager to benefit from the changes.

    The developer who updates it in the main project has no problems at all. However, if he pushes the package update (manifest.json) in the git of our main project and other developers pull this change, references to scripts of the package are lost on prefabs on their side. The game can't be started without errors anymore.

    And it's not that "Missing Script" is shown on the corresponding objects but the actual script names with brackets. Sometimes it even looks like the script is correctly referenced but all fields are missing in the editor inspector. It's not event always the same script but random scripts from our custom package. If you look in the folder of the package you can see that all files are present and also updated correctly. If you click on the fields with broken references the corresponding script of the package is even selected in the project folder.

    Here's a collection of broken references:

    bug.jpg

    bug7.jpg

    bug6.jpg

    Here's what e.g. the UIManager should actually look like:

    bug5.jpg

    Reinstalling the package does not help. The solution is that after each pull, in which a change of the package is included, the folder of the package must be reimported manually. This is very troublesome in the workflow.

    bug4.jpg

    I think I setup the package correctly, putting editor scripts into and Editor folder and runtime scripts into a Runtime folder with both having their own assembly definitions. Also the package.json is setup exactly like with all other packages we are hosting on github.

    So my question is: What is the reason that this problem occurs with this particular package? Can someone help me here? Maybe I am just missing something.

    Cheers,
    Stephan
     
    gentlymadstudios likes this.
  2. ColdBrewGames

    ColdBrewGames

    Joined:
    Oct 28, 2017
    Posts:
    4
    Heya,
    I'm getting this exact same issue - so you're not crazy!
    I'm on Unity 20222.2.4f1 - and you?
    Let me know if you find any solution
     
  3. supita_unity

    supita_unity

    Unity Technologies

    Joined:
    Dec 13, 2019
    Posts:
    226
    Hello, I'm sorry you are experiencing these issues. I suggest you report a bug (https://unity3d.com/unity/qa/bug-reporting) so you can get support in a more efficient manner. Was this problem present on previous versions of Unity that you used? Is this a new problem you are experiencing after an upgrade? Please if that's the case, let us know the versions of Unity where the problem was not present. If you could mention as much information as possible while submitting the bug it will be helpful.

    Ideally, you should first reproduce the issue so the Editor logs relevant errors and messages to its log file before you open the bug report. Also, if possible please change the Package Manager log level before triggering the problem, in order to collect as much information. You could find it under General Preferences as shown in the following screenshot.


    upload_2023-3-7_13-34-41.png
     
  4. ColdBrewGames

    ColdBrewGames

    Joined:
    Oct 28, 2017
    Posts:
    4
    Also just discovered that all the scripts re-link when going back to the previous package commit (by reverting the package-lock.json and then refreshing the editor)

    I appear to be having more success so far on 2022.2.9f1 vs 20222.2.4f1
    OP - what version are you on, can you try this?

    @supita
    I did a debug log and I can't see anything strange in it at all.
    If I get the error again on the latest editor, I'll record again and post it.
    Will let you know
     
    supita_unity likes this.
  5. Gentlymad

    Gentlymad

    Joined:
    Nov 11, 2014
    Posts:
    16
    Hi there,

    sorry for the delayed answer.

    We were originally on 2022.2.0f1 and now moved to 2022.2.9f1. Can't tell whether the issue still persists, I will have to check with the team as it is hard to reproduce because there need to be several people/machines to be involved since the issue only happens through git. So far it looks rather good.

    Thanks for your answer. I will try to file a bug report but it's hard to attach a project to reproduce as the issue mainly seems to happen through git. I will try my best to give you sufficient feedback the way you mentioned though.

    I'll keep you updated. :)

    Cheers,
    Stephan
     
    Last edited: Mar 14, 2023
    supita_unity likes this.
  6. supita_unity

    supita_unity

    Unity Technologies

    Joined:
    Dec 13, 2019
    Posts:
    226
    Hello all,

    Just to confirm that this was an issue that it's resolved on 2022.2.9f1 as reported on this thread. You can check the bug information and in which version is fixed on its issue tracker

    Cheers
     
    Last edited: Apr 13, 2023
  7. Gentlymad

    Gentlymad

    Joined:
    Nov 11, 2014
    Posts:
    16
    Hey,

    glad to hear. From our experience it seems like with 2022.2.9f1 the issue doesn't persist anymore.
    Thank you for the heads-up.
     
    supita_unity likes this.
  8. DaveLloyd

    DaveLloyd

    Joined:
    Nov 15, 2011
    Posts:
    21
    I just hit this issue on 2022.2.18 with XR Interaction Toolkit 2.4.0-pre2. Reimport fixed it as suggested by @Gentlymad - thanks!
     
    supita_unity likes this.
  9. Gentlymad

    Gentlymad

    Joined:
    Nov 11, 2014
    Posts:
    16
    Unfortunately I have to tell you that the bug still persists. By now we have 2 git packages that occasionally need to be manually reimported once someone from the team updates them through the package manager and pushes the package.json into our project's git. We are now on 2022.3.8f1. It's still not possible to create a bug report as it is hard to reproduce (happens on different machines) and I'm not sure how to turn this into a test-project since it only seems to happen through version control.
     
  10. unity_39A7BD0D58EB8979CE49

    unity_39A7BD0D58EB8979CE49

    Joined:
    Jan 18, 2023
    Posts:
    3
    We are getting the same on unity 2022.3.10f
     
    njwpsu likes this.
  11. njwpsu

    njwpsu

    Joined:
    Jun 10, 2022
    Posts:
    3
    I am experiencing the same issue after updating XR Interaction Toolkit from v2.5.2 to v2.5.3. I occasionally have to reimport the package folder to resolve things.