Advertisement

[Unity][C#]更新循环与广播哪个影响速度更高

阅读量:
复制代码
 A物体

    
 -B物体
    
 -B物体
    
 -B物体
    
 -B物体
    
 ...
    
    
    
    

for循环

A.cs

复制代码
 ...

    
         for (int i = 0; i < listchilds.Count; i++)
    
         {
    
             listchilds[i].test();
    
         }
    
 ...
    
  
    
    
    
    

B.cs

复制代码
 ...

    
 public void test()
    
 {
    
 ...
    
 }
    
 ...
    
    
    
    

update

B.cs

复制代码
 ...

    
     public A a;
    
 ...
    
     public void Update()
    
     {
    
     if(a != null)
    
     {
    
         ...
    
     }
    
     }
    
 ...
    
    
    

全部评论 (0)

还没有任何评论哟~