Accessing other objects in a script

I have a player avatar shaped roughly like a human figure, and another object that looks like a halo. I want the halo to be able to tell when the player passes beneath it and set the player as its parent (so it looks like the player is wearing the halo). I think I know how to do it, but I can’t figure out how to access the “halo” object from the script for the player avatar. How do you access another game object from an object’s script?

First time trying to help! Hope I dont confuse you more.

This example is in C#. Im going to pretend we are in your Halo Class.

PlayerAvatar player; //PlayerAvatar being your avatar class.

void Start()
{
 player = (PlayerAvatar)GameObject.Find("AvatarScript").GetComponent(typeof(PlayerAvatar));

//AvatarScript being the script name.
}

That will give you a direct link to your player from your halo class.

Hope that helps =x!

I’m not actually sure this works… isn’t the script a component of the object, not the other way around?

Never mind–I found some GameObject functions that should do it. Thanks though!