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

texture2d resize

Discussion in '2D' started by frigorifico, Nov 13, 2013.

  1. frigorifico

    frigorifico

    Joined:
    Sep 5, 2013
    Posts:
    37
    hi all,

    im trying to resize a texture2d but whem i do the image turns black
    Code (csharp):
    1.  
    2. if( clone_img_dinos.Resize(640,480))
    3.         {
    4.             clone_img_dinos.Apply();
    5.         }  
    6.  
    i got the imagem texture type as advance, and the format as RGB24

    wat im doing wrong?

    thx for help
     
  2. willgoldstone

    willgoldstone

    Unity Technologies

    Joined:
    Oct 2, 2006
    Posts:
    791
    What is the context for your 'resizing'? are you scaling the sprite within a scene? or trying to change it on import?
     
  3. frigorifico

    frigorifico

    Joined:
    Sep 5, 2013
    Posts:
    37
    in the scene...
    im doing a real time image recognition app.
    I get one imagem from WebCamTexture, and the second is given by the user.
    i need to make shure that the image given by the user is the same size as the image captured from the mobile device camera so i can compare the two

    im working whit Scale now to see if it works.
     
  4. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,387
    Resizing the texture results in undefined pixels, as explained in the docs. It doesn't scale the contents or anything. For that you can use TextureScale.

    --Eric
     
  5. frigorifico

    frigorifico

    Joined:
    Sep 5, 2013
    Posts:
    37
    thx Eric, that is the solution use scale insted on resize