void UpdateCallback() { if (cc.currentEmotion != null) { cc.EmotionTick(); } }
void OnEnable() { cc = (CharacterCustomization)target; valid = cc.gameObject.scene.IsValid() && (cc.gameObject.scene.name != cc.gameObject.name) && cc.gameObject.scene.name != string.Empty; void UpdateCallback() { if (cc.currentEmotion != null) { cc.EmotionTick(); } } EditorApplication.update = UpdateCallback; if (valid && !Application.isPlaying) { if (!bodyColors) { GetColors(cc); } cc.StartupSerializationApply(); selectedHair = cc.hairActiveIndex + 1; selectedBeard = cc.beardActiveIndex + 1; selectedShirt = cc.clothesActiveIndexes[ClothesPartType.Shirt] + 1; selectedAccessory = cc.clothesActiveIndexes[ClothesPartType.Accessory] + 1; selectedPants = cc.clothesActiveIndexes[ClothesPartType.Pants] + 1; selectedShoes = cc.clothesActiveIndexes[ClothesPartType.Shoes] + 1; selectedHat = cc.clothesActiveIndexes[ClothesPartType.Hat] + 1; emotionsList.Clear(); foreach (var e in cc.emotionPresets) { emotionsList.Add(e.name); } minLod = cc.MinLODLevels; maxLod = cc.MaxLODLevels; minCombinedLod = cc.MinLODLevelsCombined; maxCombinedLod = cc.MaxLODLevelsCombined; combinedCharacter = cc.combinedCharacter; headSize = cc.headSizeValue; headOffset = cc.GetBodyShapeWeight("Head_Offset"); height = cc.heightValue; foreach (var bsw in bodyShapeWeight.Keys.ToArray()) { bodyShapeWeight[bsw] = cc.GetBodyShapeWeight(bsw.ToString()); } foreach (var fsw in faceShapeWeight.Keys.ToArray()) { faceShapeWeight[fsw] = cc.GetBodyShapeWeight(fsw.ToString()); } } }