Hey all so I am undergoing the error as shown in the title. I can’t seem to solve it as I am not even sure as to why it is happening, anyways here’s the code creating the error.
The error occurs apparently at line which states:
diff = transform2[i + 1] - transform2[i];
```csharp
*public class xrotationcapsule : MonoBehaviour {
public Quaternion p;
public Quaternion t;
float cheekypoop = 90;
public Vector3 capsulemove;
int count1 = 0;
int count2 = 0;
int count3 = 0;
float pizza = 0.0f;
float diff;
float diff2;
string str;
List<float> transform2;
// Use this for initialization
void Start () {
capsulemove = this.gameObject.transform.position;
transform2 = new List<float> ();
InvokeRepeating ("capsulerotation", 0f, 0.0001f);
}*</em>
*_ _*csharp
*void capsulerotation()
{
for (int i = 0; i<transform2.Count; i++) {
diff = transform2[i + 1] - transform2[i];
if (diff > 0.015f)
{
str = "left";
}
else if (diff < - 0.015f)
{
str = "right";
}
else if (diff == 0){
str = "middle";
if ( cheekypoop < 90 )
{
cheekypoop += 8.000f;
}
if ( cheekypoop > 90 )
{
cheekypoop -= 8.000f;
}
}
}*</em>
```
Thanks in advance to those who help me out ![]()