//Called when block is dropped into a code list private void CodeListDropZone(GameObject draggedObject) { // Gets a reference to the codeList script CodeList codeListScript = gameObject.transform.parent.GetComponent <CodeList>(); if (codeListScript != null) //Ensures that a script is found { //Calls the AddBlock method on the Code List script if (draggedObject.tag == "CodeBlock" || gameObject.tag == "StartBlock") { codeListScript.AddBlock(draggedObject); } else if (draggedObject.tag == "CodeList") { CodeList draggedListScript = draggedObject.GetComponent <CodeList>(); if (draggedListScript != null) { codeListScript.AddBlock(draggedListScript); } } } else { Debug.Log("No Code List Script found on Parent"); } }