Search Unity

Feature Request Create Image when dragging Texture asset under Canvas, instead of Sprite Renderer

Discussion in 'UGUI & TextMesh Pro' started by huulong, Sep 5, 2022.

  1. huulong

    huulong

    Joined:
    Jul 1, 2013
    Posts:
    224
    Currently, to create an Image with a certain Texture under a Canvas, you must 1. create a new Image 2. select or drag the Texture you want.

    Sprites (as well as Meshes and other common objects associated to an asset) have a nice shortcut where dragging the asset on the scene (view or hierarchy) creates a game object with a relevant component linking to the asset.

    It almost works for Images, except Unity doesn't understand the context of being under a Canvas and will systematically create a Sprite Renderer with the texture, instead of an Image.

    While I acknowledge some edge cases where you'd want a Sprite there, in most cases we really want an Image under Canvases. Would it be possible to add an Image when a Canvas is detected on any parent (direct or indirect)? If this breaks expected behavior for users who really need sprites, could this at least be an option in Editor settings? (although I think you should make it enabled by default, and let users who prefer the old behavior disable it)