Right, this is why tutorials shouldn’t use Rider. The faded text isn’t actually code they’re written, it’s inserted by the text editor for convenience.
The actual code is just var targetAngle = Mathf.Atan2(_direction.x, _direction.z) * Mathf.Rad2Deg;
Though I wouldn’t use var for built in types, and write it float targetAngle instead to make this code more clear. This isn’t Java after all.
even if that had been the required code, you have “targetAngle;float” not “targetAngle:float” the fact rider has shown you what type will be used is definately going to confuse new people, but in watching you would see they dont type the :float portion
Code is written quickly because the code editor auto-completes a lot of stuff for us. Nonetheless you can still pause the video and see what they’ve written.
its possible hes not typing that fast, but hes voiced over some spedup bit too… Even as someone with good typing skills, in that i can almost type as fast as people talk, I watch tutorials for fun, and even i cant keep up with half of them constantly having to start/stop/rewind a bit…
So…
Declaration of a variable syntax
type name = value;
now, the = value is optional
var (i personally avoid, cos you should know what type its going to be, but it is a personal choice) tells the compiler to pick what it thinks
so you can do like
int a;
var b = 23;
if you dont, it will complain… As has been pointed out, the compiler is pretty good at pointing out what it finds wrong. Occasonally its misleading, but it is actually pretty rare… so if it says line x, character y, chances are thats exactly where it goes wrong