What I want to do is to make a script that will change the speed of a object every second, making it spin faster and faster (every second)
Here is the code that doesen’t work
using UnityEngine;
using System.Collections;
public class moveFast : MonoBehaviour {
int p = 2;
int r = 1;
void Start() {
InvokeRepeating("Add", 1.0, 1.0);
function Add() {
p += r;
}
}
void Update()
{
transform.Rotate(0, 0, p);
}
}
}
How do I solve this problem, also I’m using 2D not 3D!
The object is a ball, the error is :
Assets/moveFast.cs(10,21): error CS1525: Unexpected symbol `(', expecting `,', `;', or `='