rotation problem

I made this script to rotate a gameobject, but it dosn’t rotate on itself, why?

using UnityEngine;
using System.Collections;

public class RideDampfkarussell : MonoBehaviour {

    public GameObject teller;
    float teller_rot;

void Awake()
{
    teller_rot = 0.0f;
}


void Start()
{

}


void Update()
{
    teller_rot = (teller_rot + Time.deltaTime * 30.0f) % 360.0f;
    teller.transform.localEulerAngles = new Vector3(0.0f, teller_rot, 0.0f);
}


}

Your script is working fine for me, the only think I can think of is that you aren’t assigning the teller GameObject in the public inspector. If this is the case, you’ll be getting a NullReferenceException.

If you’re trying to rotate the GameObject the script is attached to, you don’t need to store the GameObject in the public variable, you can just use transform.localEulerAngles.

Make sure that teller GameObject is assigned to.

Are you sure that you’re even attaching your script to an object?

My experiences tell me using Euler angles is not safe. You should use rotation instead like:

teller.transform.localRotation = Quaternion.Euler(0,teller_rot,0);