public void AddInfoPanel(AnnotationVisualization annotation) { if (infoPanelPrefab != null) { go = Instantiate(infoPanelPrefab) as GameObject; AnnotationInfoPanel infoPanel = go.gameObject.GetComponent <AnnotationInfoPanel>(); infoPanel.CreateInfoPanel(annotation.data.description, annotation.data.name, (info) => { RemoveInfoPanel(info, annotation); }); //Added small delay with invoke, because layout updates only after few frames Invoke("AddToLayout", 0.1f); annotation.gameObject.SetActive(false); OpenAnnotations.Add(annotation); if (OpenAnnotations.Count > 0 && !animator.GetBool("isOpen")) { ToggleSidePanel(); } } }