Swizzle operators are convenient syntactic sugar for creating new vectors based on the combination of elements of other vectors. They are used in shading languages quite a lot.

Example:

1

2

vec4a=vec4(0.1,0.1,0.2,0.4);

vec3b=a.xyz *a.w;

This is equal to:

1

2

vec4a=vec4(0.1,0.1,0.2,0.4);

vec3b=vec3(a.x,a.y,a.z)*a.w;

They make more sense if you want to do some composition like so:

1

2

vec4 redColor=vec4(1,0,0,0.5);

vec4 redNoAlpha=vec4(redColor.xyz,1);

GLSL allows you to supply any amount of vectors or scalars in a vector constructor, as long as the count of all elements matches the dimension of the created vector.

However, swizzling isn’t allowed in most non-shading vector libraries. So, why not write simple extension methods that give that functionality to Unity?

You might have noticed that, for some meshes, calling Unity’s built-in function to
RecalculateNormals(), things look different (i.e. worse) than when calculating them from the import settings. A similar problem appears when recalculating normals after combining meshes, with obvious seams between them. For this post I’m going to show you how
RecalculateNormals() in Unity works and how and why it is very different from Normal calculation on importing a model. Moreover, I will offer you a fast solution that fixes this problem.

This article is also very useful to those who want to generate 3D meshes dynamically during gameplay and not just those who encountered this problem.