Question by
mrliioadin · Aug 22, 2017 at 06:24 PM ·
uma
Why is my UMA Gray?
Followed Anorak's tutorial.
It seems like there is issue with the overlays?
Code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UMA;
using UMA.Examples;
public class UMAMaker1 : MonoBehaviour {
public UMAGeneratorBase generator;
public SlotLibrary slotlibrary;
public OverlayLibrary overlaylibrary;
public RaceLibrary racelibrary;
public RuntimeAnimatorController animcontroller;
private UMADynamicAvatar umadynamicavatar;
private UMAData umadata;
private UMADnaHumanoid umadna;
private UMADnaTutorial umadnatutorial;
private int numberofslots = 20;
void Start()
{
GenerateUMA();
}
void GenerateUMA()
{
GameObject go = new GameObject("MyUMA");
umadynamicavatar = go.AddComponent<UMADynamicAvatar>();
umadynamicavatar.Initialize();
umadata = umadynamicavatar.umaData;
umadynamicavatar.umaGenerator = generator;
umadata.umaGenerator = generator;
umadata.umaRecipe.slotDataList = new SlotData[numberofslots];
umadna = new UMADnaHumanoid();
umadnatutorial = new UMADnaTutorial();
umadata.umaRecipe.AddDna(umadna);
umadata.umaRecipe.AddDna(umadnatutorial);
CreateMale();
umadynamicavatar.animationController = animcontroller;
umadynamicavatar.UpdateNewRace();
go.transform.parent = this.gameObject.transform;
go.transform.localPosition = Vector3.zero;
go.transform.localRotation = Quaternion.identity;
}
void CreateMale()
{
var umarecipe = umadynamicavatar.umaData.umaRecipe;
//race
umarecipe.SetRace(racelibrary.GetRace("HumanMale"));
//eyes
umadata.umaRecipe.slotDataList[0] = slotlibrary.InstantiateSlot("MaleEyes");
umadata.umaRecipe.slotDataList[0].AddOverlay(overlaylibrary.InstantiateOverlay("EyeOverlay"));
//mouth
umadata.umaRecipe.slotDataList[1] = slotlibrary.InstantiateSlot("MaleInnerMouth");
umadata.umaRecipe.slotDataList[1].AddOverlay(overlaylibrary.InstantiateOverlay("InnerMouth"));
//face
umadata.umaRecipe.slotDataList[2] = slotlibrary.InstantiateSlot("MaleFace");
umadata.umaRecipe.slotDataList[2].AddOverlay(overlaylibrary.InstantiateOverlay("MaleHead02"));
//torso
umadata.umaRecipe.slotDataList[3] = slotlibrary.InstantiateSlot("MaleTorso");
umadata.umaRecipe.slotDataList[3].AddOverlay(overlaylibrary.InstantiateOverlay("MaleBody02"));
//body
umadata.umaRecipe.slotDataList[4] = slotlibrary.InstantiateSlot("MaleHands");
umadata.umaRecipe.slotDataList[4].AddOverlay(overlaylibrary.InstantiateOverlay("MaleBody02"));
//legs
umadata.umaRecipe.slotDataList[5] = slotlibrary.InstantiateSlot("MaleLegs");
umadata.umaRecipe.slotDataList[5].AddOverlay(overlaylibrary.InstantiateOverlay("MaleBody02"));
//Feet
umadata.umaRecipe.slotDataList[6] = slotlibrary.InstantiateSlot("MaleFeet");
umadata.umaRecipe.slotDataList[6].AddOverlay(overlaylibrary.InstantiateOverlay("MaleBody02"));
}
}
gray-uma-pic.png
(228.7 kB)
Comment
Your answer
Follow this Question
Related Questions
mesh hide asset in UMA2 disappears 1 Answer
UMA2 - How do I change the avatar's lip color in code? 0 Answers
Saving UMA wardrobe recipe 0 Answers
Problem saving UMA avatar to text file via button onClick. 0 Answers
Uma2 mesh hider asset is not working 0 Answers