using unityengine.ui not working code example
Example: unity using UnityEngine; not working
Update Visual Studio Editor or Visual Studio Editor Code in window->package manger.
Get out of unity and visual studio.
Delete the .csproj and .sln files in your unity project
Open unity and it should work.