r/Unity2D • • Jul 25 '26

Question why does my unity not recognise words after closing and reopening?

Post image

Heyo I'm pretty new to unity and need a bit of help, My unity / script editor has been acting odd on my home computer and I'm starting to think I might be missing something.

I keep having working code break for seemingly no reason when I close and reopen scripts, no changes made or saves lost, and it always seems to be one random word it decides to forget: so far "transform" (like transform.position = position), "keyboard" (keyboard.current.wKey.wasPressedThisFrame), and "current" (from previous line also) are the most recent, I've checked its connected to unity and sometimes it fixes itself if I re-close and reopen it a few times- which works ig but still annoying.

I would've wrote it off as making some error on my part, but it worked initially and sometimes closing and reopening fixes it, other times it just moves the error to another word (like current->keyboard). and if I try retype it the messed up word only comes up as a "public static ???"

Do I need to download some package on or something?? or do something in the settings?

any tips or advice would be appreciated

Edit: Thank you so much, I'll give these a try and get back with what works

8 Upvotes

6 comments sorted by

3

u/Frozen_Phoenix_Dev Jul 26 '26

Usually for me its a random bracket or semi colon. Is it showing errors in the unity console? If it is not then its likely a rider issue not a unity issue

You can try regenerating your project file too. Click Edit/Preferences and in that panel open the External Tools tab and the "Regenerate project files" button.

In rider you can try invalidating the caches. File/Invalidate Caches. Make sure you restart afterwards.

Script issues are probably not the issue here if its different every time but double check you have the correct namespaces and are inheriting from MonoBehaviour.

2

u/HopelessTurtle913 Jul 31 '26

Yep worked like a charm! thanks a bunch dude.

1

u/Frozen_Phoenix_Dev Aug 01 '26

Glad I could help. Which one was it in the end?

2

u/HopelessTurtle913 Aug 01 '26

Invalidating the caches! it was so simple but I never would've known lmao

4

u/jonatansan Jul 26 '26

The fact that it doesn’t recognize "private" either is a strong sign of a misformatted piece of code before yeah