I have lots of elements inside scrollrect is there any event to know if gameobject is inside the viewport
something similar to android listview where it loads only the next element when you reach to it.
This might help you. I had colliders on my gameobjects and was testing if they are inside the camera bounds using this code:
public static bool isInsideCamera(BoxCollider collider) {
if(m_MainCamera == null) {
m_MainCamera = Camera.main;
}
if(collider == null) {
Logger.Log("The collider is null : " +collider.gameObject.name);
}
// calculate the current camera frustrum planes
m_CameraPlanes = GeometryUtility.CalculateFrustumPlanes(m_MainCamera);
bool isInCamera = GeometryUtility.TestPlanesAABB(m_CameraPlanes, collider.bounds);
return isInCamera;
}
If your objects dont have colliders, then you can calculate the bounds somehow and send them to the TestPlanesAABB function.