Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

Question importing 2D sprites in Unity

Discussion in 'UGUI & TextMesh Pro' started by julien83franceschi, Sep 17, 2023.

  1. julien83franceschi

    julien83franceschi

    Joined:
    Nov 14, 2020
    Posts:
    251
    Hello,

    Here's my problem: I'm creating an Image UI (in a Canvas).

    I import .jpg or .png images into the asset tab.

    I move them in the Hierarchy tab, but a cursor with a Stop panel prevents me from clicking and dragging.

    The same applies to the text field below (Source Image):



    Thanks for your help,

    A+
     
  2. bugfinders

    bugfinders

    Joined:
    Jul 5, 2018
    Posts:
    2,256
    well that expects a sprit, did you make your imports sprites?
     
  3. julien83franceschi

    julien83franceschi

    Joined:
    Nov 14, 2020
    Posts:
    251
    Sorry, but the Image Source option doesn't accept my images (even though they're in .png format).

    I've also tried putting my image in the Hierarchy tab.
    But the cursor displays a cross.

    Your help is most welcome,

    A+
     
    Last edited: Sep 18, 2023
  4. julien83franceschi

    julien83franceschi

    Joined:
    Nov 14, 2020
    Posts:
    251
    Hi,

    I tried to do the same thing with an existing program.
    And it works perfectly.

    I put the UI Image in a canvas.

    I can't figure it out.

    If you have any ideas,

    they're most welcome.
     
  5. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,761
    You're not making much sense here TBH. The question was asked, are you trying to drag a sprite here which is exactly what it's expecting? You wouldn't drag a GameObject or an Audio file here just like you'd only drag a Sprite. A "png" is just an image file, that's not a Sprite.

    If you have made a sprite (imported your "png") then you'll have a Sprite asset you can drag here. That's the basics of how it works. If you don't understand this then I would highly recommend some tutorials on this.
     
  6. julien83franceschi

    julien83franceschi

    Joined:
    Nov 14, 2020
    Posts:
    251
    I managed to click and drag the texture to the 'Source Image' option in the Inspector tab, and the same for the Hierarchy panel.

    The image is displayed perfectly.

    The problem is that after changing some parameters, the same problem as in the message above occurs.
    No drag and drop from the image to the 'Source Image' option in the Inspector tab, same for the Hierarchy panel.

    I have no idea what the problem is.

    Everything was working perfectly, then the UIImage bugg .

    Thanks for your help,

    A+
     
  7. julien83franceschi

    julien83franceschi

    Joined:
    Nov 14, 2020
    Posts:
    251
    J'ai remarqué que le bug ne se faisait pas avec des images (vignettes dans l'onglet Project) qui ont une petite flêche grise dans un cercle gris sur le côté droit (voir image suivante).



    J'aimerais que vous me disiez comment créer cette petite flêche.
    Pour cliqué-glisser mon image vers l'option 'Source image'.

    Merci à vous,

    A+