Avatar System
Avatar should have place where it can get spawned, so for this move prefab LocalObjectsRoot from ReadyGamesNetwork/Example/Prefabs to scene.

Below we will need this object to set up AvatarAppController
Avatar app controller contains all required references for default UI Implementation.
First you need move prefab AvatarAppController from ReadyGamesNetwork/Example/Prefabs to scene, then fill up references:
- On AvatarAppController select Body Size Panel from scene
- On AvatarAppController select Local Objects Root Manager from scene
- On ClothingStoreManager select Sub Categories Container from scene by this path: ClothingStorePanel -> SelectedClothesCategory -> BottomPanel -> SubCategories Scroll View -> Viewport -> Content
- On ClothingStoreManager select Items Container from scene by this path: ClothingStorePanel -> SelectedClothesCategory -> BottomPanel -> Layout -> Items Scroll View -> Viewport -> Content
- On ClothingStoreManager select Items Container Scroll from scene by this path: ClothingStorePanel -> SelectedClothesCategory -> BottomPanel -> Layout -> Items Scroll View -> Viewport -> Content
- On ClothingStoreManager select Empty Items Placeholder from scene by this path: ClothingStorePanel -> SelectedClothesCategory -> BottomPanel -> EmptyClothingIcon
- On ClothingStoreManager select Look Book Button Parent from scene by this path: ClothingStorePanel -> LookBookPanel -> BottomPanel -> Items Scroll View -> Viewport -> Content
- On MaterialEditorReconstructor select Local Objects Root Manager from scene
- On CustomThumbnailCreator select Custom Cloths Spawn Point from scene by this path: LocalObjectsRoot -> CustomizationIconManager -> OutfitSpawnPoint
- On CustomThumbnailCreator select Custom Clothes Photo Camera from scene by this path: LocalObjectsRoot -> CustomizationIconManager -> CustomClothesCamera

First of you need that is Camera for avatar rendering, so create additional camera and position it to make it look on avatar container
If you using default Local Objects Root with default position, set camera position equals to (x: 100, y: 1.6, z: -6.1) and rotation equals to (x: 7.35, y: 0, z: 0)
Also FOV should be 24

Then add two components on created camera, the first is CameraToRenderTexture and the second is CameraController and set up them like on screenshot bellow

Main Camera equals to character camera and Avatar Object equals to LocalObjectsRoot -> LocalAvatarManager -> AvatarSpawnPoint from the scene if you use default Local Objects Root
For displaying avatar easiest way to use Raw Image, so create one in canvas and add two components on it, the first is RTDisplayScaller and the second is AspectRatioFitter, last thing to display avatar use this code:
Texture2D texture = characterCamera.GetComponent<CameraToRenderTexture>().cameraTexture;
avatarRawImage.texture = texture;
avatarRawImage.GetComponent<RTDisplayScaler>().RescaleContainer(texture.width, texture.height);
characterCamera is the created above camera and avatarRawImage is the created above RawImage respectively
There is two ways to implement UI for avatar module:
- Default prefab panels
- Custom prefab panels
Default prefab panels have two variants for portrait and for landscape specific games, you can find them in ReadyGamesNetwork/Example/Prefabs/Panels/Portrait and in ReadyGamesNetwork/Example/Prefabs/Panels/Landscape respectively.
Using default prefab panels you also should use default UI panel system called UIRoot.
First you need to create Canvas and setup it like at screenshot below

Then create two child objects, the first named UIRoot and the second named UIPopup

Now move next prefabs under UIRoot:
- ColorPalettePanel
- ModularCustomizationPanel
- MaterialEditorPanel
- CreatorDashboardPanel
- JoinCreatorProgramPanel
- ClothingStorePanel

Then move next prefabs under UIPopup
- CurrencyErrorPopUpPanel
- BuyTexturePopUp
- SaveProfileChangesPopup
- JoinCreatorProgramPopUp
- BuyItemsPopUpPanel
- ColorPickerPopUpPanel
- SpinnerPopup

- Select Color Pallete Panel reference from scene by this path: UIRoot -> ColorPalletePanel
- Select Loading Screen reference from scene by this path: UIPopup -> SpinnerPopup
- Select Color Pallete Panel reference from scene by this path: UIRoot -> ColorPalletePanel
- Select Color Controller reference from scene by this path: AvatarAppController -> ColorController
- Select Starting Anchor reference from scene by this path: AvatarAppController -> Cameras -> CameraAnchors -> Clothing Store Landing Anchor
- Select Zoomed In Anchor reference from scene by this path: AvatarAppController -> Cameras -> CameraAnchors -> Zoomed In Clothing Store Landing Anchor
- Select Zoomed in Shoe Anchor reference from scene by this path: AvatarAppController -> Cameras -> CameraAnchors -> Clothing Store Shoe Landing Anchor
- Select Clothes Customization Manager reference from scene by this path: AvatarAppController -> ClothingStoreManager
- Select UI Camera reference and select camera which you use for UI displaying
For this, you need to add an ClothingStoreModule in Initialisation. Refer Initialise the RGN SDK.
string firebaseStorageUrl = applicationStore.firebaseStorageURL;
RGNCoreBuilder.AddModule(new ClothingStoreModule(firebaseStorageUrl));
ClothingStoreModule clothingStoreModule = RGNCoreBuilder.I.GetModule<ClothingStoreModule>();
RGNClothingStoreData clothingStoreData = await clothingStoreModule.GetItems();
Return RGNClothingStoreData object, which contains following fields:
List<RGNClothingItem> allItems
- list of clothing items correspond current applicationList<RGNCustomizedClothingItem> customizedItems
- list of customized items created by current userList<RGNCustomizedClothingItem> allCreatorItems
- list of creator items created and published by usersList<TextureDatas> allCreatorTextures
- contains info about all creator texturesList<string> ownedTextures
- list of creator textures id which user haveList<string> ownedItems
- list of clothing item id which user haveList<string> allLookIds
- list of look id which user createdint totalLookbookSlot
- number of maximum lookbook slotsRGNCurrency lookBookSlotPrice
- price to purchase additional lookbook slotstring ftuItemId
- item id which can be used to tutorial case (allows user purchase this item for free)List<RGNExclusiveCollection> exclusiveCollections
- list of clothing item exclusive bundles
In order to buy items, it requires to call the following function by passing list of items unique id (List<string>) as a parameter.
ClothingStoreModule clothingStoreModule = RGNCoreBuilder.I.GetModule<ClothingStoreModule>();
RGNBuyItemData buyItemData = await clothingStoreModule.BuyItems(itemIds);
Return RGNBuyItemData object, which contains following fields:
bool isSuccess
- result of purchasing, can be false if for example user haven't enough currenciesList<RGNCurrency> currencies
- list of actual user currencies after purchasing
In order to buy creator item, it requires to call the following function by passing creator item unique id (string) as a parameter.
ClothingStoreModule clothingStoreModule = RGNCoreBuilder.I.GetModule<ClothingStoreModule>();
RGNBuyCustomizedItemData buyItemData = await clothingStoreModule.BuyCreatorItem(itemId);
Return RGNBuyCustomizedItemData object, which contains following fields:
bool isSuccess
- result of purchasing, can be false if for example user haven't enough currenciesList<RGNCurrency> currencies
- list of actual user currencies after purchasingstring addedItemId
- if purchase is success equals to unique id of purchased creator item
Variant of above function which allows to buy list of creator items.
ClothingStoreModule clothingStoreModule = RGNCoreBuilder.I.GetModule<ClothingStoreModule>();
RGNBuyCustomizedItemsData buyItemsData = await clothingStoreModule.BuyCreatorItems(itemIds);
Return RGNBuyCustomizedItemsData object, which contains following fields:
bool isSuccess
- result of purchasing, can be false if for example user haven't enough currenciesList<RGNCurrency> currencies
- list of actual user currencies after purchasingList<RGNCustomizedClothingItem> addedItems
- if purchase is success contains list of purchased items
In order to buy creator textures, it requires to call the following function by passing list of creator texture unique id (List<string>) as a parameter.
ClothingStoreModule clothingStoreModule = RGNCoreBuilder.I.GetModule<ClothingStoreModule>();
RGNBuyCreatorTexturesData purchaseInfo = await clothingStoreModule.BuyCreatorTextures(itemIds);
Return RGNBuyCreatorTexturesData object, which contains following fields:
bool isSuccess
- result of purchasing, can be false if for example user haven't enough currenciesList<RGNCurrency> currencies
- list of actual user currencies after purchasingList<TextureDatas> addedItems
- if purchase is success contains list of purchased textures
In order to buy customized item, it requires to call the following function by passing customized item with needed customizations (RGNCustomizedClothingItem) as a parameter.
ClothingStoreModule clothingStoreModule = RGNCoreBuilder.I.GetModule<ClothingStoreModule>();
RGNBuyCustomizedItemData purchaseInfo = await clothingStoreModule.BuyCustomizedItem(item);
Return RGNBuyCustomizedItemData object, which contains following fields:
bool isSuccess
- result of purchasing, can be false if for example user haven't enough currenciesList<RGNCurrency> currencies
- list of actual user currencies after purchasingstring addedItemId
- if purchase is success equals to unique id of purchased customized item id
Variant of above function which allows buy list of customized items.
ClothingStoreModule clothingStoreModule = RGNCoreBuilder.I.GetModule<ClothingStoreModule>();
RGNBuyCustomizedItemsData purchaseInfo = await clothingStoreModule.BuyCustomizedItems(items);
Return RGNBuyCustomizedItemsData object, which contains following fields:
bool isSuccess
- result of purchasing, can be false if for example user haven't enough currenciesList<RGNCurrency> currencies
- list of actual user currencies after purchasingList<RGNCustomizedClothingItem> addedItems
- if purchase is success contains list of purchased customized items
Last modified 11mo ago