Problem with == Null

I have a problem
I have this script :

if (Vertices == null)   
		{  
			Vertices = d.Vertices;  
			Triangles = d.Triangles;  
			Uvs = d.Uvs;  
			Debug.Log ("activated Null in meshdata "+Vertices.Length);  
		}   

My Problem is that Vertices isn’t Null but gets activated
The debug.log says:

activated Null in meshdata 4
UnityEngine.Debug:Log(Object)
MeshData:add(MeshData) (at Assets/Source/MeshData.cs:37)

Im not an expert so please explain it as easy as possible :slight_smile:
Thank you in Advance :slight_smile:

  1. if (Vertices == null)
  2. Vertices = d.Vertices;
  3. Debug.Log ("activated Null in meshdata "+Vertices.Length);

So the code block runs if Vertices is null.

The very next statement sets Vertices to d.Vertices. Vertices is no longer null.

You’re then logging the length of Vertices (which is the same as d.Vertices).