Search Unity

How to use sprites and sprite masks in a 3D environment

Discussion in 'Editor & General Support' started by cgaunce, Oct 27, 2020.

  1. cgaunce

    cgaunce

    Joined:
    Feb 27, 2018
    Posts:
    5
    My scene has lots of picture frames and art pieces on the walls. I'd like to fill them up with pictures and art in the most efficient way, without having to resize each one to adjust for different aspect ratios.

    My hope is to have a few different prefabs for the frames I'm using, e.g. Landscape 6x4, Portrait 4x6, etc. I've populated those different prefabs around the scene and now would like to be able to simply drop a unique sprite onto the sprite renderer contained in each prefab instance. That works fine but then I have to manually adjust the sizing of every sprite after dropping it in to match the aspect ratio and size of the frame. I'd like to drop in the new sprite, and simply scale my image down without changing the aspect ratio, and have the frame act as a mask for the sprite. Is that possible?

    It seems like a sprite mask should be able to do that but my attempts so far have been unsuccessful. I'm not even sure if it's possible to use a sprite mask within a 3D environment like I'm suggesting. Any help would be greatly appreciated. Thanks!