How to modify deformer's params in script?
zzm88 opened this issue · comments
using UnityEngine;
using Deform;
public class script : MonoBehaviour
{
private float bend_angle;
void Start()
{
// get deformable
script deformable = GetComponent<script>();
Deformable d = deformable.GetComponent<Deformable>();
}
void Update()
{
//tried to access and modify Angle param here but fail
bend_angle = d.DeformerElements[0].Component.Angle;
}
}
It says "Unknown member: Angle", but I can see Angle and other params are under Component in watch window.
what is the correct way to do that?
d
is declared within the Start
method so it is not accessible from the Update
method. You need to declare it alongside bend_angle
so that any function in the script has access to it.