/// <summary> /// ARCore looks for certain things as soon as the component is enabled, so we have to delay /// it. First, we disable the object hierarchy in question. Then, we execute the code to /// create the ARCore objects. Finally, we re-enable the hierarchy. /// </summary> /// <param name="src"></param> /// <param name="act"></param> public static void WithLock(this Component src, Action act) { src.Deactivate(); act(); src.Activate(); }