Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
ShardNZL's avatar
ShardNZL
Explorer
7 years ago

Adding colliders by List Loop - after load - would that decrease load time significantly?

Just a general Unity knowledge query....
I have scenes with 50-60 mesh/box colliders in them. In some scenarios I don't need them so I thought why not make a list of GameObjects that use them and then on scene load check to see if they're needed and apply one per frame. I believe that if you turn them off in the editor and on by script that Unity recreates them form scratch anyway?
Would this significantly reduce load time since it'll only be loading geometry/lighting etc - and 60 colliders per second shouldn't slow down the page load??

3 Replies

Replies have been turned off for this discussion
  • bkj's avatar
    bkj
    Adventurer
    On mobile most time is spent loading big textures.
  • hmmmm - any insights into why this isn't working?? .....
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    ....
    public BoxCollider bc;
    public List<GameObject> BoxColliders = new List<GameObject>();
    ....
    void Start () {
    StartCoroutine(drawBoxes());
    }

    public IEnumerator drawBoxes(){
    foreach(GameObject data in BoxColliders){
    bc = data.AddComponent<BoxCollider>();
    yield return new WaitForEndOfFrame();
    }
    }







  • PAalto's avatar
    PAalto
    Expert Protege
    That code snippet does not show where you add items to the BoxColliders list? I assume you do that somewhere.. :)