Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

UI image scripting

Discussion in 'Scripting' started by paavithra, May 22, 2019.

  1. paavithra

    paavithra

    Joined:
    May 22, 2019
    Posts:
    1
    I am developing a quiz game. The question will be an image and player has to choose the correct word that represent the image from 4 options. I have a json file like this:

    {
    "questionImage" : "Assets/sprites/EiffelTower.jpg",
    "option1" : "Statue Of Liberty",
    "option2" : "Eiffel Tower",
    "option3" : "Leaning Tower of Pisa",
    "option4" : "Burj Khalifa",
    "answer" : "option2"
    },

    when the player clicks "start game" or when the next question is loaded, the script should display the image stored in questionImage path. I am able to load the text but I am not able to load images. I am beginner. Please let me know the syntax to load images to a gameobject from the path.
     
  2. Antistone

    Antistone

    Joined:
    Feb 22, 2014
    Posts:
    944