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. Dismiss Notice

Scripted Importers: Identifier uniqueness violation

Discussion in 'Scripting' started by korbul, Feb 21, 2018.

  1. korbul

    korbul

    Joined:
    Jan 20, 2014
    Posts:
    16
    Hello, I'm using the scripted importers pipeline to import a custom 3d format.
    The files contain the 3d model as well as the bone armature.
    It wen't pretty well so far but I've reached a warning that I don't know what to do about.

    upload_2018-2-21_12-27-50.png

    This happens when I create the bone hierarchy and I parent them. It seems that if a bone has more than 1 child, this warning is thrown.
    I'm not using ctx.AddObjectToAsset() for each bone transform. I'm just parenting them to their parent and to the main asset. If I also use ctx.AddObjectToAsset() on each bone transform, the bones are duplicated and I get a bunch of other errors. I believe ctx.AddObjectToAsset() would solve the problem if the duplication would not happen. My guess is that an import name is not assigned to the bones that I parent and are given the default name of Transform and that's why there are multiple identifiers like name/name/transform.

    Anyone knows how I can fix these warnings?
     
    ivaylo5ev likes this.
  2. korbul

    korbul

    Joined:
    Jan 20, 2014
    Posts:
    16
    So I tried to find the simplest code that reproduces this problem.

    Code (CSharp):
    1. public override void OnImportAsset(AssetImportContext ctx)
    2. {
    3.     GameObject test = GameObject.CreatePrimitive(PrimitiveType.Cube);
    4.     test.name = "root";
    5.  
    6.     GameObject child = GameObject.CreatePrimitive(PrimitiveType.Cube);
    7.     child.name = "child1";
    8.  
    9.     GameObject child2 = GameObject.CreatePrimitive(PrimitiveType.Cube);
    10.     child2.name = "child2";
    11.  
    12.     child.transform.SetParent(test.transform);
    13.     child2.transform.SetParent(test.transform);
    14.  
    15.     ctx.AddObjectToAsset("rootasset", test);
    16.     ctx.SetMainObject(test);
    17. }
    I also tried to make a prefab from the hierarchy and then add it. Same problem :(
     
    Last edited: Mar 3, 2018
  3. korbul

    korbul

    Joined:
    Jan 20, 2014
    Posts:
    16
    I'm not sure if it's related, but the first time I import a custom asset through the script I also get an error:

    If I right click -> reimport after that, I only get the warnings.
     
  4. markvi

    markvi

    Unity Technologies

    Joined:
    Oct 31, 2016
    Posts:
    118
    Hi, thanks for bringing this to my attention - I've asked a developer to take a look. Could you help us out and log a bug report from your repro project directly with the "Report a Bug..." feature? thanks! edit: and post the bug # here when you get the confirmation e-mail, please.
     
  5. jasonm_unity3d

    jasonm_unity3d

    Unity Technologies

    Joined:
    Mar 2, 2017
    Posts:
    41
    Can you give me the exact unity build version you are using?

    Thanks.
     
  6. jasonm_unity3d

    jasonm_unity3d

    Unity Technologies

    Joined:
    Mar 2, 2017
    Posts:
    41
    I just checked and that is a bug that got fixed for the next release of unity: 2018.1

    those warnings wont prevent the import from occurring but will lead to issues when re-importing the same asset. Any object references to the sub-objects (child1 and child 2 in your example) will break and you then need to have some sort of re-connecting pass (manual or programatic)

    but if objets only reference the main object (root in your example) then you can safely ignore the warnings.
     
  7. korbul

    korbul

    Joined:
    Jan 20, 2014
    Posts:
    16
    Hey guys,
    Thanks for investigating.
    @markvi since jason found it's fixed in 2018.1, i'm guessing i should not submit a bug anymore
     
  8. markvi

    markvi

    Unity Technologies

    Joined:
    Oct 31, 2016
    Posts:
    118
    Correct, and thank-you for bringing the issue to our attention!
     
  9. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,685
    This is happening for me in Unity 2019.1.13f1
     
  10. wantondalliance

    wantondalliance

    Joined:
    Aug 22, 2018
    Posts:
    34
    Also getting 'Identifier uniqueness violation...' in 2019.2.2f1
     
  11. fherbst

    fherbst

    Joined:
    Jun 24, 2012
    Posts:
    801
    Same here. It seems identifier uniqueness warning occurs for example when a mesh added after a transform has the same name as that transform.
     
  12. mick129

    mick129

    Joined:
    Jun 19, 2013
    Posts:
    228
    Same problem here with a substance on Unity 2018.4.01f
     
  13. MikeUpchat

    MikeUpchat

    Joined:
    Sep 24, 2010
    Posts:
    1,055
    The same happening with my importer, its very annoying, any word from Unity on this?
     
  14. MadeFromPolygons

    MadeFromPolygons

    Joined:
    Oct 5, 2013
    Posts:
    3,875
    Have any of you filed bug reports? If not can you please do that and post back with the case ID here, as thats the proper way to handle a bug. Mentioning it on the forums without a bug report gets you nowhere.
     
  15. Elringus

    Elringus

    Joined:
    Oct 3, 2012
    Posts:
    482
  16. gevasaf

    gevasaf

    Joined:
    Jan 25, 2014
    Posts:
    6
    this message also appears when running a scripted importer on unity 2018.4.11f1

    we suspect this causes sever issues with version control of our project - on some machines the project loads with tons of missing prefabs
     
  17. AdamBebko

    AdamBebko

    Joined:
    Apr 8, 2016
    Posts:
    161
    Getting same problem in 2020.1.13. Doesn't say which objects are affected so difficult to debug

    Identifier uniqueness violation: 'Name:Missing Prefab (Dummy), Type:GameObject'. Multiple Objects with the same name/type are generated by this Importer. There is no guarantee that subsequent imports of this asset will properly re-link to these targets.
     
    bomal likes this.
  18. bomal

    bomal

    Joined:
    Jul 3, 2018
    Posts:
    6
    Getting same problem in 2021.1....is there a solution in sight?
     
  19. danUnity

    danUnity

    Joined:
    Apr 28, 2015
    Posts:
    229
    Getting that issue in 2020.3.26f1!
     
  20. hippogames

    hippogames

    Joined:
    Feb 5, 2015
    Posts:
    228
    Hi! The same here. I've got missed references after migrading from 2020 to 2021. But the error disappears when I open the project back in 2020.

    Identifier uniqueness violation: 'Name:HeadDead, Type:Sprite'. Multiple Objects with the same name/type are generated by this Importer. There is no guarantee that subsequent imports of this asset will properly re-link to these targets.
     
    marios-trophygames likes this.
  21. abushaheen

    abushaheen

    Joined:
    Feb 18, 2021
    Posts:
    4
    The same issue still occur in Unity version 2021.3.3
    Identifier uniqueness violation: 'Name:, Type:Sprite, FileId:2877471580529523173'. Multiple Objects with the same FileId are generated by this Importer. There is no guarantee that subsequent imports of this asset will properly re-link to these targets.
     
  22. KageKirin

    KageKirin

    Joined:
    Jan 22, 2014
    Posts:
    50
    Hi, I'm working on a custom importer and getting this issue as well.
    Is there a way to prevent it (i.e. by naming components adequately)?

    I already made material names more unique by prefixing them with a specific name, but is there anything I can do regarding regular MonoBehaviour-based components?
     
  23. Boodums

    Boodums

    Joined:
    Jan 16, 2023
    Posts:
    6
    I'm seeing the same problem with build 2021.3.25f1