Debugging locals, vector3 normalized repeating

When looking at a vector3 in Visual Studio Debugger, “normalized” is repeating. I don’t know how deep. Maybe infinite?

Is this normal? Is this a bug in Unity, Visual Studio, UnityVS?

The script is super simple, btw, if you want to recreate

private Vector3 normalizedTest;

	void Start () {
    normalizedTest = new Vector3(0, 0, 1);
	}

1 Answer

1

That’s no bug. The system is working as designed.

The normalized property returns a new Vector3, which of course also has its own normalized property. You cannot continue to the “bottom” because calling that function will always increase the depth of your call stack by one.

You’re effectively asking for Vector3.forward.normalized.normalized.normalized and so on, which makes no sense but is a perfectly legal operation as far as the compiler is concerned.

That seems weird. So, am I essentially calling the function when I click it in Locals or would it repeat forever regardless? I mean, it seems kind of like an infinite loop, which would be bad for performance, but as long as it's working correctly, there's no reason for me to be concerned. I'm trying to look for the cause of some performance issues, which is why I was looking at it in the first place. You'll have to excuse me, I'm a noob at debugging using tracepoints and breakpoints. Thank you for the reply. I've marked it as the Best Answer.

You saved my lots of time @Zewde