Search Unity

  1. Unity 2020.1 has been released.
    Dismiss Notice
  2. We are looking for feedback on the experimental Unity Safe Mode which is aiming to help you resolve compilation errors faster during project startup.
    Dismiss Notice
  3. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

public Image not show in Inspector

Discussion in 'Scripting' started by gamer123454321, Aug 1, 2020.

  1. gamer123454321

    gamer123454321

    Joined:
    Mar 25, 2020
    Posts:
    21
    Hi! In script I tried to public different type of variable, they all show in Inspector except Image. Can Anyone Help?
     
  2. Terraya

    Terraya

    Joined:
    Mar 8, 2018
    Posts:
    138
    try to use :

    Code (CSharp):
    1. [SerializeField] public Image test;
     
  3. gamer123454321

    gamer123454321

    Joined:
    Mar 25, 2020
    Posts:
    21
    still not working either with [SerializeField] or not

    public Image test; this code work on other scripts but not work on GameManager script or the script I'm work on
     
  4. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    2,560
    Do you have any compile errors in your console?
     
  5. gamer123454321

    gamer123454321

    Joined:
    Mar 25, 2020
    Posts:
    21
    No error. Game is playable
     
  6. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    2,560
    Can you share the whole script and a screenshot of the inspector?
     
  7. gamer123454321

    gamer123454321

    Joined:
    Mar 25, 2020
    Posts:
    21
    even sprite works fine
    question.png question2.png
     
  8. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    2,560
    Replace
    Code (CSharp):
    1. using UnityEngine.UIElements
    with
    Code (CSharp):
    1. using UnityEngine.UI;
     
  9. gamer123454321

    gamer123454321

    Joined:
    Mar 25, 2020
    Posts:
    21
    It works. Thank yo so much!!:)
     
unityunity