A
A
aeaeae12021-03-14 17:36:04
C++ / C#
aeaeae1, 2021-03-14 17:36:04

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));
 
            }
    }
 }

What am I doing wrong? Why doesn't it call bkendshapes? Please tell me who knows.
I need to use the Change button to
604e5f7163546164795946.png
change the Open value to 100
604e5f89ab59b165958110.png
Open is in BlendShapes

How else can I access BlendShapes through a script?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
wichidt, 2021-03-17
@wichidt

Try to address through a point.
skinnedMesh.BlendShapes.open or skinnedMesh.BlendShapes.Open
I don't know myself, but as an option.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question