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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

LoadTexture after promptphoto

Discussion in 'Scripting' started by Tarzan111, May 12, 2015.

  1. Tarzan111

    Tarzan111

    Joined:
    Oct 8, 2014
    Posts:
    72
    Hi guys.
    I'm using prime31 plugin to prompt a photo. My image link is : data/data/my_bundle_id/image.jpg

    I'm trying to load the picture as a texture :
    Code (JavaScript):
    1.  
    2. textureseat[nbrplayer] = Resources.Load(mylink);
    3.  
    I also tried :
    Code (JavaScript):
    1.  
    2. textureseat[nbrplayer] =Resources.LoadAssetAtPath(mylink, (Texture2D));
    3.  
    I tried with and without the ".jpg". But my texture stay "NULL". Can't understand why.

    Thanks
    Leo
     
  2. K0lipser

    K0lipser

    Joined:
    May 12, 2015
    Posts:
    8
    Your image has to be stored under /Resources. Your image link has to be /data/... .
    Resources.Load(path) starts searching from /Resources, and not at the top of your project path

    #edit

    Sry, I have not seen prime31. Never used it, sry ;)
     
    Last edited: May 12, 2015
  3. Tarzan111

    Tarzan111

    Joined:
    Oct 8, 2014
    Posts:
    72
    I'm not sur to get it.
    I'm taking the picture with prime31 plugin :

    EtceteraAndroid.promptToTakePhoto( "photo.jpg" );

    Then when the succedevent is call, i received a string with the image link. (/data/data/mybundleid/cache/photo.jpg)

    textureseat[nbrplayer] = Resources.Load(mylink);

    I don't know how to store it in the /Resources folder
     
    Last edited: May 12, 2015