Get Component on Instantiated Object

Hi Guys and girls!

I am having an unusual issue. So far the script looks like this.

var ozzy : GameObject;
var portalPlacer : PortalPlacer;

function Start() 
{
	ozzy = GameObject.Find("Ozzy");
	portalPlacer = ozzy.GetComponent(PortalPlacer);
}

Nothing fancy yet, but for some reason it will not get the Script attached to the game object names “Ozzy”. Normally I would write GameObject.Find(“Ozzy”).GetComponent(PortalPlacer); but I was experiencing issues so wrote this way for now.

I have used code like this for ages, but I think this is the first time it’s been on an object that is instantiated and is also attached to a child, but anyway.

It finds the Game Object Ozzy, but wont get the script!

Can anyone offer advice?

Thanks in advance!

Try this

    portalPlacer = ozzy.GetComponent<PortalPlacer>();