private void ScrollToEnd() { CoroutineProxy.Instance.StartCoroutine(CoroutineProxy.RunNextFrame(() => { var height = _cachedView.Content.GetHeight(); _cachedView.Content.anchoredPosition = new Vector2(0, Mathf.Max(0, height - _parentHeight)); })); }
private void InitUICamera(Canvas c) { Transform trans = new GameObject("SocialUICamera").transform; _uiCamera = trans.gameObject.AddComponent <Camera>(); _uiCamera.orthographic = true; CoroutineProxy.Instance.StartCoroutine(CoroutineProxy.RunNextFrame(() => { _uiCamera.orthographicSize = _trans.GetHeight() * 0.5f; })); _uiCamera.farClipPlane = 1000; _uiCamera.nearClipPlane = -1000; _uiCamera.cullingMask = 1 << (int)ELayer.UI; _uiCamera.clearFlags = CameraClearFlags.Depth; _uiCamera.depth = (int)ECameraLayer.AppUICamera; trans.localPosition = new Vector3(-500, -500, 0); c.renderMode = RenderMode.ScreenSpaceCamera; c.worldCamera = _uiCamera; c.planeDistance = 20; }