Answer the question
In order to leave comments, you need to log in
Why is the script for bledshapes not working in Unitu?
Good afternoon! I have a problem in unity. I need to make it so that in unity, when the button is pressed, blendshapes (face parameters) change. There is a model of a person in Unity and you need to make it so that when the button is pressed, blendshapes works for me, I have it Open.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class NewBehaviourScript4 : MonoBehaviour {
SkinnedMeshRenderer skinnedMeshRenderer;
Mesh skinnedMesh;
int Open = 500;
int blendSpeed = 100;
bool eyesClosed = false;
public void Start()
{
skinnedMeshRenderer = GetComponent<SkinnedMeshRenderer>();
skinnedMesh = GetComponent<SkinnedMeshRenderer> ().sharedMesh;
}
public void Update ()
{
//(float Open = 0f; Open < 100f; Open++)
if (Open !=0 )
{
skinnedMeshRenderer.SetBlendShapeWeight (100,Open);
//skinnedMeshRenderer.updateWhenOffscreen = true;
//Debug.Log ("BlendShape value" + skinnedMeshRenderer.GetBlendShapeWeight (100));
}
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question