void CreateAvatarPrefab() { GameObject gameObject = realtimeAvatar.gameObject; //// Root // RealtimeView RealtimeView rootRealtimeView = AddRealtimeViewComponentIfNeeded(gameObject); // RealtimeAvatar AddComponentToRealtimeViewIfNeeded(rootRealtimeView, realtimeAvatar); // RealtimeTransform RealtimeTransform rootRealtimeTransform = AddRealtimeTransformComponentIfNeeded(gameObject, true); AddComponentToRealtimeViewIfNeeded(rootRealtimeView, rootRealtimeTransform); //// Head Transform head = CreateGameObjectForPropertyIfNeeded(headProperty, gameObject.transform, "Head", new Type[] { typeof(Examples.VoiceScale) }); // RealtimeView RealtimeView headRealtimeView = AddRealtimeViewComponentIfNeeded(head.gameObject); // RealtimeTransform RealtimeTransform headRealtimeTransform = AddRealtimeTransformComponentIfNeeded(head.gameObject, false); AddComponentToRealtimeViewIfNeeded(headRealtimeView, headRealtimeTransform); // RealtimeAvatarVoice RealtimeAvatarVoice headRealtimeAvatarVoice = head.gameObject.GetComponent <RealtimeAvatarVoice>(); if (headRealtimeAvatarVoice == null) { headRealtimeAvatarVoice = head.gameObject.AddComponent <RealtimeAvatarVoice>(); // Collapse inspector SetComponentInspectorExpanded(headRealtimeAvatarVoice, false); } AddComponentToRealtimeViewIfNeeded(headRealtimeView, headRealtimeAvatarVoice); //// Left Hand Transform leftHand = CreateGameObjectForPropertyIfNeeded(leftHandProperty, gameObject.transform, "Left Hand"); // RealtimeView RealtimeView leftHandRealtimeView = AddRealtimeViewComponentIfNeeded(leftHand.gameObject); // RealtimeTransform RealtimeTransform leftHandRealtimeTransform = AddRealtimeTransformComponentIfNeeded(leftHand.gameObject, false); AddComponentToRealtimeViewIfNeeded(leftHandRealtimeView, leftHandRealtimeTransform); //// Right Hand Transform rightHand = CreateGameObjectForPropertyIfNeeded(rightHandProperty, gameObject.transform, "Right Hand"); // RealtimeView RealtimeView rightHandRealtimeView = AddRealtimeViewComponentIfNeeded(rightHand.gameObject); // RealtimeTransform RealtimeTransform rightHandRealtimeTransform = AddRealtimeTransformComponentIfNeeded(rightHand.gameObject, false); AddComponentToRealtimeViewIfNeeded(rightHandRealtimeView, rightHandRealtimeTransform); }
void Awake() { // Get a reference to the RealtimeAvatarVoice component _voice = GetComponent <RealtimeAvatarVoice>(); }