Ich bekomme hier jedesmal die in der Überschrift genannten Fehlermeldung
Kann mir jemand helfen und meinen Code anpassen, sodass es funktioniert?
using UnityEngine;
using System.Collections;
public class Obj_float : MonoBehaviour {
public float maxUpAndDown = 1; // amount of meters going up and down
public float speed = 50; // up and down speed
float angle = -90; // angle to determin the height by using the sinus
float toDegrees = Mathf.PI/180; // radians to degrees
float startHeight; // height of the object when the script starts
void Start (){
startHeight = transform.localPosition.y;
}
void FixedUpdate (){
angle += speed * Time.deltaTime;
if (angle > 270) angle -= 360;
Debug.Log(maxUpAndDown * Mathf.Sin(angle * toDegrees));
transform.localPosition.y = startHeight + maxUpAndDown * (1 + Mathf.Sin(angle * toDegrees)) / 2;
}
}