Can't access transform rotation from script

void Update()
{
    transform.Translate(0f, movSpeed * Time.deltaTime, 0f);
    if (Input.GetMouseButtonDown(0))
    {
        Debug.Log("click");
    }
    if (transform.localRotation.eulerAngles.z == -45)
        Debug.Log("rotated");
}

in the inspector my rotation on z is set to -45, nothing logs in the console, tried making a GameObject variable, didn’t work, tried putting this.transform, didn’t work, doesn’t matter if it’s -45 or -45f, it just doesn’t work

What exactly are you attempting here??

The above expression will almost guaranteed NEVER be true. Here’s why:

Floating (float) point imprecision:

Never test floating point (float) quantities for equality / inequality. Here’s why:

https://starmanta.gitbooks.io/unitytipsredux/content/floating-point.html

“Think of [floating point] as JPEG of numbers.” - orionsyndrome on the Unity3D Forums

Furthermore, reading Euler angles back from a transform is almost ALWAYS a disaster, or at least a complexity you don’t want. More reading:

All about Euler angles and rotations, by StarManta:

https://starmanta.gitbooks.io/unitytipsredux/content/second-question.html