public Image from c# script dont show up in the inspector

I have a strange problem, when trying to add a Image from my script(just started to write it), it don’t show up in the inspector, i have try to restart both Unity and VsCode, nothing happen, anyone had this problem?If a had for example ,a public int it work, never had any problem like that before

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UIElements;


public class UIFade : MonoBehaviour
{

    public Image fadeScreen;
    private bool shouldFadeToBlack;
    private bool shouldFadeFromBlack;
    public int test;

Change this:

using UnityEngine.UIElements;

To this:

using UnityEngine.UI;

Strangely, i dont have this option, i got this message:

The type or namespace name ‘UI’ does not exist in the namespace ‘UnityEngine’ (are you missing an assembly reference?) [Assembly-CSharp, Assembly-CSharp]csharp(CS0234)

I’m not sure? I did confirm what you said though - public Image doesn’t show up in the Inspector (unless that’s changed to UnityEngine.UI).

Maybe check Package Manager and make sure Unity UI is installed?
6160909--673651--unity_ui.jpg

I think you found the problem ,but i dont have Unity UI??

Just found it in All packages, i will try to reinstall it

Finally i have upgrade my project to Unity 2020.1.0f1 and that fixed the problem.

1 Like