public void AddCharacterPortraits() { foreach ( CharacterAsset res in CharacterLibrary.Instance.Characters) { if (res == null) continue; var portrait = _imageTemplate .Create(_imageTemplate.transform.parent) ?.GetComponent<RawImage>(); if (portrait != null) { if ( CharacterRosterPreview .Instance .GetCharacterPreview( _index, res.Id, out CharacterPreview preview)) { portrait.texture = preview.RenderTexture; } _portraits.Add(portrait); } } if (_imageTemplate != null) { _portraitHeight = _portraits[0].GetComponent<LayoutElement>().preferredHeight; _totalHeight = _portraitHeight * _portraits.Count; _offset = 0; _imageTemplate.gameObject.SetActive(false); } }