Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(3 edits)

New to unity, downloaded on 2022.3.4f1 with 2 errors

Assets\TopDownController2D\Scripts\TopDownCharacter2D\UI\EntityHealthGaugeUpdater.cs(4,19): error CS0234: The type or namespace name 'UI' does not exist in the namespace 'UnityEngine' (are you missing an assembly reference?)

Assets\TopDownController2D\Scripts\TopDownCharacter2D\UI\EntityHealthGaugeUpdater.cs(13,34): error CS0246: The type or namespace name 'Slider' could not be found (are you missing a using directive or an assembly reference?)

How to fix? And yes, Cinemachine and Input System are installed

Edit: Seems that UnityEngine.UI (Line 4) isn't a proper namespace type and removing it seems to fix it. And "Slider" (Line 13)... isn't a real thing? Did you mean SliderEditor?

UnityEngine.UI is indeed a valid Unity namespace https://docs.unity3d.com/Packages/com.unity.ugui@1.0/api/UnityEngine.UI.html and it's a built-in package in Unity, Maybe you have it disabled in the package manager? (Window->Package Manager ->Select Package: Built-in -> Search for the package named "UI") It's strange since it's also supposed to be a dependency of the Input System package.  Either way the UI elements are not really supposed to be used as-is, it's mostly an implementation example so you could just remove those files either way and use your own UI.

And the reason the type "Slider" is not recognized is most probably because you don't have the UI package not because I don't know how to type (Errors like that are usually caused by how your project is setup since Unity has a lot of package that can be enabled or disabled)

What exactly do you mean by "the UI package"? If you're talking about Unity UI, I installed it and still nothing. I have both UI and UIElements built-in and enabled.

I mean that if you remove "using UnityEngine.UI" from the file that use the type "Slider" it will cause issues either way because it's the namespace that contains the "Slider" type. 

Did you try to install my package on a new project? If you have Unity UI installed it should work. But it seems to be a common issue maybe you can find more info on how to solve that here https://forum.unity.com/threads/solved-the-type-or-namespace-ui-does-not-exist-i... 

(1 edit)

Ok, so after reinstalling the package, along with Unity UI and the other 2, it works without any errors. I don't know exactly how it worked, but apparently it just does lol

Either the package or Unity is running off some real spaghetti 

Deleted 279 days ago

If it helps by the way, I found multiple missing scripts in the "Player" "Enemy_Range" "Enemy_Contact" and "Player_Close" prefabs.