//イメージデータから作成 void MakeImageFromAvartorData(AvatarData data) { if (AvatarData == null) { return; } List <Sprite> parts = data.MakeSortedSprites(avatarPattern); foreach (var part in parts) { if (part == null) { continue; } RectTransform child = RootChildren.AddChildGameObjectComponent <RectTransform>(part.name); child.gameObject.hideFlags = HideFlags.DontSave; Image image = child.gameObject.AddComponent <Image>(); image.material = this.Material; image.sprite = part; image.SetNativeSize(); UguiFlip flip = image.gameObject.AddComponent <UguiFlip>(); flip.FlipX = flipX; flip.FlipY = FlipY; } }
void Refresh() { RootChildren.DestroyChildrenInEditorOrPlayer(); avatarPattern.Rebuild(AvatarData); MakeImageFromAvartorData(AvatarData); OnPostRefresh.Invoke(); }