Setting the parent of a transform which resides in a prefab is disabled to prevent da

I’ve read other posts about this error:

I’m not seeing how I am setting the parent of the transform within the prefab from the looks of it I am changing the parent of the clone. Can someone explain what i’m doing wrong. Not looking for someone to fix this for me I want to understand what I am not seeing here.

	void populateMountPoints()
	{
		GameObject clone = CannonType;
		foreach (Transform t in GetComponentsInChildren<Transform>()) 
		{
			if (t.name == "MountPointCannon")
				clone = Instantiate (CannonType, t.position, t.rotation) as GameObject;
				clone.transform.parent = transform;

		}

Ok I figured it out.

To anyone who runs into a similar issue the following line:

Was making clone a direct pointer to the prefab so I was in fact editing the parent of the prefab. See the following line where CannonType was previously defined in the code:

CannonType then had a prefab attached to it from the editor as a result I had to change the code to the following to not create this kind of link:

Derp