Here is the Spin script attached to a circle object:
using UnityEngine;
using System.Collections;
public class Spin : MonoBehaviour {
public float speed = 10f;
// Update is called once per frame
void Update () {
transform.Rotate (Vector3.forward, speed * Time.deltaTime);
}
}
I’ve dragged the GameObject (“Radar Main”) into the On Value Changed slot. For function, I choose Spin and a list comes up. I’ve tried different selections, but none of them control ‘speed’, the only public float/variable in the script. What am I missing? Thanks.
see screenshot:
This is expected; you haven’t defined a function which accepts a float value. Try adding the following to your Spin class.
public void SetSpeed(float speed)
{
this.speed = speed;
}
That should adjust the speed as expected, but it’s not totally clear that’s what you’re intending. Either way I hope this helps you do what you’re trying to do.