- Home /
Using new operator without naming instance
So what is the difference between
Vector3 osman = new Vector3(15, 30, 45); transform.Rotate(osman*Time.deltaTime);
and
transform.Rotate(new Vector3(15,30,45)*Time.deltaTime); ?? Performance issues? in functionality, they both work, but is there an advantage to using one of them?
Comment
Answer by wooolly · May 12, 2018 at 04:03 PM
I see no performance benefit in using one or the other, they are pretty much the same. If you're going to use the vector again later on, then assign it to a variable, otherwise use the second method would be my recommendation.
" If you're going to use the vector again later on" Agreed. In fact, other than "readability", I would say this is the ONLY reason to EVER use a variable.