- Home /
Question by
rick-grendel · Jul 31, 2014 at 01:09 PM ·
c#itweeninvokerepeatingfaster
Invokerepeating and itween problems
hello Im making a script with itween here is the script: using UnityEngine; using System.Collections;
[RequireComponent(typeof(AudioSource))]
public class RotateBy : MonoBehaviour {
public float snelheid = 2F;
public AudioClip geluid;
void Start () {
audio.clip = geluid;
audio.loop = true;
audio.Play ();
iTween.RotateBy (gameObject,iTween.Hash (
"x", 2,
"speed", snelheid
));
}
void Example () {
InvokeRepeating ("Faster", 2, 0.3F);
}
I want The InvokeReating thing on the "snelheid" thing In rule 17 I want that the object with this script goes faster and faster but fail. can anyone help me?
Comment
Best Answer
Answer by robertbu · Jul 31, 2014 at 02:00 PM
Rather than use iTween, just do this in Update() to rotate:
transform.Rotate(Time.deltaTime * speed, 0,0);
'speed' is a variable you declare at the top of the file. Then in your Faster function, increase the value of 'speed'.