using UnityEngine; namespace Normal.Realtime.Examples { public class VoiceMouthMove : MonoBehaviour { public SkinnedMeshRenderer[] skinned; private RealtimeAvatarVoice _voice; private float _mouthSize; void Awake() { _voice = GetComponent(); } void Update() { if (skinned != null) //not sure whether work or not { float targetMouthSize = Mathf.Lerp(0.1f, 1.0f, _voice.voiceVolume); _mouthSize = Mathf.Lerp(_mouthSize, targetMouthSize, 30.0f * Time.deltaTime); foreach (SkinnedMeshRenderer s in skinned)//not sure whether work or not { s.SetBlendShapeWeight(41, _mouthSize * 100); s.SetBlendShapeWeight(17, _mouthSize * 50); s.SetBlendShapeWeight(6, _mouthSize * 20); } } } } }
top of page

Inspector GUI

  • 作家相片: fang ma
    fang ma
  • 2022年3月17日
  • 讀畢需時 1 分鐘

public variables shown in the Inspector when inheriting


Class used on game object

using UnityEngine;
 using System.Collections;
 using UnityEngine.UI;
 using System;
 
 [Serializable]
public class UIButton : Button
{
    public enum TestEnum { ON, OFF }
 
    public int testInt;
    public TestEnum testEnumVar;
}

Class used to override the inspectorGUI

 using UnityEngine;
 using System.Collections;
 using UnityEditor;
 [CustomEditor(typeof(UIButton))]
public class UIButtonEditor : Editor
{
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();
        UIButton t = (UIButton)target;
    }
}

相關文章

查看全部

Comentarios


  • Facebook
  • Twitter
  • LinkedIn

©2021 by Mianzi Ltd

bottom of page