Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

PSB issue: How to export Sprites from Unity (and update Sprite-References) ?

Discussion in '2D' started by wiredninja, Apr 21, 2022.

  1. wiredninja

    wiredninja

    Joined:
    Jul 5, 2021
    Posts:
    15
    Hi,

    I'm facing an issue with PSD importer when upgrading to Unity's current LTS 2021, where my sprite references are all gone after the upgrade. This only affects sprites in PSB Prefabs, as it seems.

    So my question is:

    Is it possible to simultanously
    - get the sprites out of the PSB (export sprites)
    - save them in a separate asset (sprite-atlas?)
    - have the project update it's sprite-references to the new asset(s)


    ...so that there'll be nothing referencing the original PSB file/prefab, before attempting another try on upgrading the project.

    Thanks in advance!
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,951
    Are you properly source-controlling and maintaining the assigned GUIDs contained in the original metafiles??

    AFAIK it should just stay linked, unless Unity has a bug or the import process has substantively changed. Here is why:

    Some info about Missing script warnings, GUIDs, renaming GUIDs, etc:

    https://forum.unity.com/threads/problem-with-git-and-missing-scripts.1090876/#post-7024801
    https://forum.unity.com/threads/scr...ead-after-loading-editor.998413/#post-6487297
    https://forum.unity.com/threads/scr...ead-after-loading-editor.998413/#post-6488230

    EVERYTHING in Unity is connected to the above GUID, which is stored ONLY in the metafile.

    It is super-easy to inadvertently change it by renaming outside of Unity. Don't do that. Instead:

    - close Visual Studio (important!)
    - rename the file(s) in Unity
    - in Unity do Assets -> Open C# Project to reopen Visual Studio
    - now rename the actual classes, and MAKE SURE THE FILE NAMES DO NOT CHANGE!

    If you are NOT using source control while you do this, renaming files is an EXTREMELY dangerous process. Use source control at all times so that you can trivially revert if you miss a critical step and damage your project.

    If you are not already doing so, please consider using proper industrial-grade enterprise-qualified source control in order to guard and protect your hard-earned work.

    Personally I use git (completely outside of Unity) because it is free and there are tons of tutorials out there to help you set it up as well as free places to host your repo (BitBucket, Github, Gitlab, etc.).

    You can also push git repositories to other drives: thumb drives, USB drives, network drives, etc., effectively putting a complete copy of the repository there.

    As far as configuring Unity to play nice with git, keep this in mind:

    https://forum.unity.com/threads/prefab-links-keep-getting-dumped-on-git-pull.646600/#post-7142306

    Here's how I use git in one of my games, Jetpack Kurt:

    https://forum.unity.com/threads/2-steps-backwards.965048/#post-6282497

    Using fine-grained source control as you work to refine your engineering:

    https://forum.unity.com/threads/whe...grammer-example-in-text.1048739/#post-6783740

    Share/Sharing source code between projects:

    https://forum.unity.com/threads/your-techniques-to-share-code-between-projects.575959/#post-3835837

    Setting up an appropriate .gitignore file for Unity3D:

    https://forum.unity.com/threads/removing-il2cpp_cache-from-project.1084607/#post-6997067

    Generally setting Unity up (includes above .gitignore concepts):

    https://thoughtbot.com/blog/how-to-git-with-unity

    It is only simple economics that you must expend as much effort into backing it up as you feel the work is worth in the first place.

    "Use source control or you will be really sad sooner or later." - StarManta on the Unity3D forum boards
     
    Leo-Yaik likes this.
  3. Ted_Wikman

    Ted_Wikman

    Unity Technologies

    Joined:
    Oct 7, 2019
    Posts:
    883
    @wiredninja from which version are you upgrading your project from? And could you by any chance share your PSB + meta files with me so I can take a closer look?

    Thanks!
     
  4. wiredninja

    wiredninja

    Joined:
    Jul 5, 2021
    Posts:
    15
    @Kurt-Dekker thank you for your Post, man! I'm using Source Control (and Git as well, via Terminal since I'm working on Ubuntu, and thus I'm using Rider as my primary IDE) so I feel a little bad that you went all the way referencing the way to set up SC just for me - but I do appreciate it. Also, I assume your infos reference Assets in general, since you talk specifically about classes/scripts? I'll checkout the posts you've linked and see if I can solve my issue with that information, and then I'll post the results here after. Thanks again!
     
  5. wiredninja

    wiredninja

    Joined:
    Jul 5, 2021
    Posts:
    15
    @Ted_Wikman

    The Issue (broken sprite references in Sprite-Renderer components) occurs after Upgrading from 2020.3.32f1 (Personal, Ubuntu Linux) to 2021.3.0f1 (Personal, Ubuntu Linux). The Upgrade from the previous version to 2020.3.32f1 on the same system went smoothly.

    Regarding the 2 PSB files, they're just sketched prototypes - I'll pm them.

    FYI, if it's useful to you. Some history regarding file creation / etc, as far as memory serves...

    Draw in Sketchbook (Android) => export PSD => transfer to Ubuntu System => import & save in Krita-Format & edit with Krita => export again to PSD => rename to PSB & copy into project assets.

    Can't guarantee the above process to be exact, though.
     
    Ted_Wikman likes this.
  6. Ted_Wikman

    Ted_Wikman

    Unity Technologies

    Joined:
    Oct 7, 2019
    Posts:
    883
  7. Alturis2

    Alturis2

    Joined:
    Dec 4, 2013
    Posts:
    38
    I am running into a similar issue. I am trying to create a new 2020 project and pull assets from my alpha 2022 project as I was doing some experimentation with ECS. But I am seeing that when I export my sprites from 2022 and import then into 2020 any other assets that are included in that same package that referenced those sprites lose their connection.

    Is there a procedure here I am missing?
     
  8. Alturis2

    Alturis2

    Joined:
    Dec 4, 2013
    Posts:
    38
    Ah, it appears to only be sprites that are Multiple frames. Appears that there is some kind of incompatibility with multiframe sprites from more recent unity versions with older versions. Man that sucks. Doesnt seem like the converstion should be that complicated. Would be nice if the Package Exporter had a target Unity version option to it and could do that.
     
  9. Alturis2

    Alturis2

    Joined:
    Dec 4, 2013
    Posts:
    38
    No that doesnt make any sense. In looking at the file contents of the .meta files they are nearly identical. Same fileformatversion, same GUIDs for the sprite sheet entries. Doesnt make any sense!
     
  10. Ted_Wikman

    Ted_Wikman

    Unity Technologies

    Joined:
    Oct 7, 2019
    Posts:
    883
    @Alturis2 some questions to clarify your problem:
    - What file extension does your texture file have?
    - Are you using the PSD Importer to import the texture?
    - Which 3rd party DCC tool did you use to create these textures?

    Thanks to @wiredninja, we managed to track down an issue with the PSD Importer for psd files created in Krita. The fix is currently being verified by our QA team, and will be out in a coming PSD Importer version.
     
  11. Leo-Yaik

    Leo-Yaik

    Unity Technologies

    Joined:
    Aug 13, 2014
    Posts:
    434
    Would you be able to share the source file or file a bug so that we can take a look to see if it's the same issue mentioned