bug? with raycasts and booleans

I’m not getting a match when the 2 colors align vertically, and only the top one doesn’t work, here is a video of the issue:

I have debugged the rays and this is the result of the rays, they ignore the layer the object they are inside in of, when dragged outside this happens

http://i.gyazo.com/ec05f22e2d615aaa1f1c581e993ae4b2.png

Then when next to eachother:

alt text

Here is the code for it, I broke it all up attempting to find what was going on:

using UnityEngine;
using System.Collections;

public class Cylinder : MonoBehaviour {

	public bool cylinderRay;
	public LayerMask layerToIgnore;

	void Start () {
		Color objectColor = renderer.material.GetColor("_Color");
		}
	void Update () {
		Cylinder otherObject;
		Color objectColor = renderer.material.GetColor("_Color");
		RaycastHit hit;
		Vector3 angle0 = transform.TransformDirection(Vector3.up);
		cylinderRay = Physics.Raycast(transform.position, angle0, out hit, 1);
		Debug.DrawRay (transform.position, angle0 * 1, Color.blue);
		   if(cylinderRay){
			if(hit.transform.tag == "Cylinder" && !hit.transform.parent.GetComponent<Molecule>().isFalling){
			Color otherObjectColor = hit.collider.renderer.material.GetColor("_Color");
			Molecule molecule = hit.transform.parent.GetComponent<Molecule>();
				if(objectColor != otherObjectColor){
					print ("this object isn't the same color as me");
					if (objectColor == Color.green){
						transform.parent.GetComponent<Molecule>().GreenCylMatch = false;
					}
					if(objectColor == Color.blue){
						transform.parent.GetComponent<Molecule>().BlueCylMatch = false;
					}
					if(objectColor == Color.red){
						transform.parent.GetComponent<Molecule>().RedCylMatch = false;
					}
				}
			if(transform.parent.GetComponent<Molecule>().hasMatches){
					if(objectColor == otherObjectColor){
				molecule.hasMatches = true;
				}
			}
			if(transform.parent.GetComponent<Molecule>().hasMatches 
				   || hit.transform.parent.GetComponent<Molecule>().hasMatches){
					if(objectColor == otherObjectColor){
						print ("other object has my color");
						molecule.hasMatches = true;
					}
					transform.parent.GetComponent<Molecule>().matchFound();
				}
			

			if(objectColor == otherObjectColor){
				
				if(objectColor == Color.green && otherObjectColor == Color.green){
						print ("other object is my color and im green");
						transform.parent.GetComponent<Molecule>().GreenCylMatch = true;
						hit.transform.parent.GetComponent<Molecule>().GreenCylMatch = true;
				} 
				if(objectColor == Color.blue && otherObjectColor == Color.blue){
						print ("other object is my color and im blue");
						transform.parent.GetComponent<Molecule>().BlueCylMatch = true;
						hit.transform.parent.GetComponent<Molecule>().BlueCylMatch = true;
				} 
				if(objectColor == Color.red && otherObjectColor == Color.red){
						print ("other object is my color and im red");
						transform.parent.GetComponent<Molecule>().RedCylMatch = true;
						hit.transform.parent.GetComponent<Molecule>().RedCylMatch = true;
				}
				}
			} 
		} else {
			print ("ray not hitting anything or incorrect object");
			if (objectColor == Color.green){
				transform.parent.GetComponent<Molecule>().GreenCylMatch = false;
			}
			if(objectColor == Color.blue){
				transform.parent.GetComponent<Molecule>().BlueCylMatch = false;
			}
			if(objectColor == Color.red){
				transform.parent.GetComponent<Molecule>().RedCylMatch = false;
			}
		}
	}
}

The print it gives me is “Not hitting cylinder or other object is falling”, the other object is not falling and that boolean is false, what could be wrong here or am I casting incorrectly?
The strangest thing is that not all of them do it, but if they do it it’s nearly always the same row and always vertically down, the upper cylinder.

Make sure that you are not transforming static colliders, that could corrupt the physics scene and make Raycast to return wrong results. See the Static Colliders section: