#The type or namespace name 'UI' does not exist in the namespace 'UnityEditor'

1 messages · Page 1 of 1 (latest)

dusky dune
#

Ok so I'm very new to Unity (most time spent in Unreal) so this may need to be explained to me like I'm 5 but I've seen a hundred decade old forum posts about this issue and every solution suggested is wildly different and has never worked - so I'm asking here. Right now I have an extremely primitive version of my project and would like to export it simply to test how it builds, since I've never built a unity project before. However, when I build the project, I instantly get these errors relating to the first few lines in a couple scripts, relating to the references some scripts need. I can clearly see Visual Studio already has the relevant references but it seems to still be giving me errors about how it doesn't recognize them. ALSO: I even tried just commenting out all the lines it's talking about and it actually built with no errors logged, but when you play, every game object disappears the moment you interact with it. AND, after doing this, the game works completely as intended in the editor, which I don't even understand how that's possible. I really have no idea what's happening here lmao, but I assume commenting out these lines would be related. How do I build this stupid project - haven't had any luck looking through forums or videos so any help would be greatly appreciated.

floral halo
dusky dune
floral halo
#

If you have a script that uses any UnityEditor namespace, it needs to be put in a folder named Editor to exclude it from the build, or put in an assembly definition that isn't included for your platform

dusky dune
floral halo
#

Any folder named exactly Editor will be excluded from the build

dusky dune
#

ok interesting

floral halo
#

Well, if you want the files to be used in the project you'll want it to be in the Assets folder

dusky dune
#

oop

dusky dune
#

how am i supposed to do stuff without using UnityEditor references

floral halo
floral halo
dusky dune
#

i think im getting the picture but why would you have references that only work in editor
how do i get references that allow me to test functions in editor while still letting me build the same functions

#

is there some FAQ somewhere i should read about this

floral halo
dusky dune
subtle wave
#

if you must have editor references in non-editor scripts, you'd use conditional compilation, ex

#if UNITY_EDITOR
#endif

to ensure that code is only included in the editor

floral halo
#

The "alternative" is don't

dusky dune
#

i appreciate the help btw

dawn vortex
dusky dune
#

also not sure if this is related to the original problem anymore, but excluding lines related to the unityeditor namespace just results in the same thing (random object disappearing) as commenting these lines out manually, what is the issue here that im missing

#

either they were autogenerated or i put them in manually because it wouldnt recognize commands i knew should work until i put it in because i am a scrub

dusky dune
# floral halo What is disappearing

the player is invisible, and the cubes (they represent vending machines you get stuff out of lol) disappear once you interact with them, and the little moving guys disappear after they do one of their automatic functions (farm money for you) - below video is what its supposed to look like

floral halo
#

Are the objects that are disappearing in the UI or in world space

dusky dune
#

also strange because the cubes outright de-exist rather than being invisible, while player control works totally fine despite not being visible

#

player collision and physics still intact

floral halo
#

I notice that you seem to have a lot of error shaders, maybe replacing them with one that works in your render pipeline would be best

#

unless these are compatible shaders and you've specifically turned them pink

dusky dune
#

that makes sense, but where do you see that? someone im working with has been working on a custom shader for a bit and she is also new to unity

floral halo
#

Pink means shader error

#

Which usually means incompatible with your current render pipeline

dusky dune
#

oh wtf i thought it just meant no texture

dusky dune
dusky dune
#

whatever i guess

#

all seems to be well except for one small thing which hopefully i can figure out

#

thanks so much for ur help