Trying to make a way to check if an instance of an object is on the screen

Hello,

I am trying to implement a feature to my game where you check if there is an instance of an object just floating around and if there is (do something) i have been trying to implement that feature for a couple of days now but i just can’t get around it. I tried using unity’s id system but it didn’t work. Can anyone give me like a foundation on where to start from because i just really don’t know what to do. by the way i use c# and i would say i don’t have much experience with it so if you are going to say something please do not show me like something really complex because i won’t know what to do probably. I am saying this because obviously i won’t know what to do and i will waste your time.

Thank-You,
DevGoose

Pretty simple, add your object reference to gameobject,
for example,

public GameObject obj;

in update() add
{
    if(obj.transform.childCount > 0)
{
     var gameObject =  obj.transform.GetChild(obj.transform.childCount-1);
     Debug.Log("Yes it's flying around");
}

}

The above method checks for child if there are any and you can do something if you want with it.

1 Like

You can use TestPlanesAABB which is fed by CalculateFrustumPlanes
This technique lets you check whether a bounding box is visible by the camera frustum.

1 Like

Thank-You guys saved me a lot of precious time and i also learned a lot.