Setting parent causing unknown problems

I am trying to text a text box running, so the player can kinda get a story perspective as they play my game, and so they can know other important stuff. Right now, my script is producing the errors

=The best overloaded method match for `UnityEngine.Transform.SetParent(UnityEngine.Transform)’ has some invalid arguments

=Argument #1' cannot convert UnityEngine.GameObject’ expression to type `UnityEngine.Transform’

I am calling the function form outside of the actual script, not sure that is what is causing the problem at all. The parent object that the text prefab is going into has a grid layout, so it should fall in line(as i guessed) when it works(so the original instantiate location of it should bear no unwanted results as i am guessing)

using UnityEngine;
using System.Collections;

public class TextBox : MonoBehaviour {

	public GameObject TextObject;
	public GameObject TextArea;

	public void AddText(string Words){
//I do not know any other way of temp hiding a gameobject that works, but this works
		Instantiate (TextObject, new Vector3 (99999, 99999, 99999), Quaternion.identity);
		UnityEngine.UI.Text displayedtext = TextObject.GetComponent<UnityEngine.UI.Text>();
		Words = "| " + Words;
		displayedtext.text = Words;
		TextObject.transform.SetParent (TextArea);
	}
}

If you go look up the documentation for Transform.SetParent, you’ll see that the parameter it expects is of type Transform. You’re passing in a parameter of type GameObject. This is also what the error message is telling you. Pass in TextArea.transform instead.

As evident from the error message, you are trying to pass a GameObject (TextArea) to the SetParent function, but it only accepts a Transform.

TextObject.transform.SetParent (TextArea.transform);

Solved it completely, Apperently this works

GameObject NewObject = instantiate(prefab);
NewObject.Transform.SetParent = ParentObject.Transform;

but this did not:

GameObject NewObject = instantiate(prefab, new vector 3 (999,999,999), quaterniun.identity);
NewObject.Transform.SetParent = ParentObject.Transform;