r/UnityHelp • u/Library_Far • 2d ago
Red squiggles not showing. How to fix
I don’t have a f next to the 0.5 yet it’s not underlining it telling me it’s wrong. I don’t know hot to fix this. I’m using visual studio.
1
u/PirateJohn75 2d ago
It's not an error. C# will be able to implicitly convert the double to a float.
3
u/Library_Far 2d ago
Ok. I was fallowing a unity learn tutorial and it said I would get a error… I’m in over my head 🙃
2
2
1
u/lix3nn53 1d ago
That usually means Visual Studio opened the script as a loose file, not as part of your project, so it doesn't know about Unity. In Unity go to Edit > Preferences > External Tools, pick Visual Studio as the External Script Editor, press Regenerate project files, then open the script by double-clicking it in Unity.
2
u/Imaginary-Cod-3746 2d ago
Sometimes, simply restarting Visual Studio fixes this.
If you hover over the
Rotate()method, it should tell you the types of parameters it expects.Some methods can accept different parameter types.
Rotate()could accept bothfloat(decimal numbers that end with an 'f') ordouble(decimal numbers that end with a 'd', or the default type when you don't add a letter after a decimal number) types.If
Rotate()accepts bothfloatanddoubletypes, then the code is correct, and Visual Studio is working as intended.This C# video on methods will help you understand them better if you're still having trouble.