Search Unity

Question Problem with UI and Sprite

Discussion in 'Visual Scripting' started by loafy123, Aug 26, 2020.

  1. loafy123

    loafy123

    Joined:
    Feb 19, 2020
    Posts:
    8
    I am creating a picture quiz game the generate randomly with only true or false.
    So i create array with list of pictures as sprite.
    Since my question is generated randomly I need to create an Image to hold the sprites, and Image = CurrentQuestion.But then I encounter several problems.
    With error :
    -An object reference is required for the non-static field, method, or property 'Questions.questionImg' Assembly-CSharp
    -Cannot implicitly convert type 'UnityEngine.Sprite' to 'UnityEngine.UI.Image'
    upload_2020-8-26_20-45-27.png
     
  2. payalzariya07

    payalzariya07

    Joined:
    Oct 5, 2018
    Posts:
    85

    in you code line no 37 you not define CurrentQuestion class image
     
  3. loafy123

    loafy123

    Joined:
    Feb 19, 2020
    Posts:
    8
    How do i define it?
     
  4. payalzariya07

    payalzariya07

    Joined:
    Oct 5, 2018
    Posts:
    85
    in GameManager debug class details
     
  5. enesylmz2642

    enesylmz2642

    Joined:
    Feb 16, 2023
    Posts:
    1
    I am having the same problem. Couldn't find the answer. I need picture quiz code examples.