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

Sprites and Transparency at Run-time

Discussion in 'General Graphics' started by BrienKing, Dec 22, 2015.

  1. BrienKing

    BrienKing

    Joined:
    Oct 11, 2015
    Posts:
    35
    My game will allow the player to provide their own Avatar image. Is there an easy way (without reprocessing the image) to make a specific color in the Sprite transparent?

    Basically I want to say "What ever color is at 0,0 is the Transparent color".
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,236
  3. BrienKing

    BrienKing

    Joined:
    Oct 11, 2015
    Posts:
    35
    I'm new to Unity, so maybe I'm not sure what you mean.
     
  4. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,236
    Generally if you want transparency in an image you just have the image have transparency using the alpha channel instead of making a specific color transparent.
     
  5. BrienKing

    BrienKing

    Joined:
    Oct 11, 2015
    Posts:
    35
    That's kind of what I figured what you were getting at. The issue here is, that I won't be the one providing the images. They could come to me in JPG, PNG, etc... formats. The images will be loaded dynamically. Was hoping there was something built into Unity that would say "Make this color transparent'.

    It looks like I'll just need to re-process the image once it's been sent to me to deal with it that way.
     
  6. projectorgames_unity

    projectorgames_unity

    Joined:
    Oct 15, 2018
    Posts:
    107
    I mean, if 'adding an extra 33% to the size of your data' isn't a reason not to, I'm not sure what is.
     
  7. hatless

    hatless

    Joined:
    Dec 15, 2010
    Posts:
    48
    Even in 2015, 'adding an extra 33% to the size of your data' wouldn't have mattered. :)