Search Unity

Question Culling Group API vs OnBecomeVisible/OnBecameInvisible Performance?

Discussion in 'Scripting' started by kaiyum, Jul 28, 2022.

  1. kaiyum

    kaiyum

    Joined:
    Nov 25, 2012
    Posts:
    686
    Hi, I am doing crowd simulation of several thousands agents. I wish to process the AI logic only with the agents that are ONLY visible in the Main Camera currently rather than processing all of them. I can see I can get visibility information from two ways:
    By visibility information, I meant whether or not a particular object is visible to camera or not. For example, "Agent A is visible but a bit far from camera than Agent B"--this information is irrelevant to me. Rather "Agent A or B has just become visible, so turn on the AI and Animation logic. Turn off otherwise"---this is very much relevant to me.

    So my question: "Which one I should use for better performance?"
     
    Wilhelm_LAS and shuntecoud like this.