Search Unity

From hierarchy to prefab: prefab loses its sprite

Discussion in 'Immediate Mode GUI (IMGUI)' started by FeastSC2, Apr 11, 2017.

  1. FeastSC2

    FeastSC2

    Joined:
    Sep 30, 2016
    Posts:
    978
    I've managed to create an object in the hierarchy automatically when I import a texture.

    However, as soon as it becomes a prefab, it doesn't have its sprite attached to it anymore.
    Here's the bug shown in a gif:
    http://i.imgur.com/HbbtDk1.gifv

    Explanation of the gif:
    - I import a texture, it creates a prefab(no sprite) + an object in the scene(with sprite).
    - so I drag the scene object into my folder and it still loses its sprite.

    It's really a weird thing, does someone know why this occurs?
     
  2. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,778
    If your sprite is an Instance and not a reference to a Sprite Asset then this will happen as a prefab cannot save a reference to an instance of something the same way you cannot set a prefab gameObject reference to an object in a scene.

    That would be my guess. but it's hard to know form that gif.
     
  3. FeastSC2

    FeastSC2

    Joined:
    Sep 30, 2016
    Posts:
    978
    Oh yes, that must be it. Thank you.