#Problem with scripts

1 messages · Page 1 of 1 (latest)

sudden dew
#

Please, learn the very basics of C# before you start working in Unity, because there is a lot wrong with this code:

  • You cannot declare a field inside a method.
  • You cannot declare a class inside a method.
  • You cannot declare a class like an abstract method.
  • You cannot separate parameters with semicolons; you need to use commas instead.
formal sparrow
#

using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class Orbiting : MonoBehaviour
{
public float speed;

private void update()
{    
transform.Rotate(new Vector3(0f, 0f, speed) * Time.deltaTime);
}

}

#

like this?

sudden dew
#

That looks like it should work, yes.

formal sparrow
#

it still doesnt appear

#

also im sorry if its a really obvious problem, ive never really done anything with unity before

sudden dew
#

Do you have any compiler errors from other scripts?

formal sparrow
#

i dont have any other scripts in that project

#

and when i run the game theres also no error messages

random sigil
#

Method name

formal sparrow
#

both the file and the method are called Orbiting

#

but i think i found the error

#

the inspector shows this, even though the script itself is completely different but when i open the script it is my actual code

#

ok, i got it working now by overwriting a part of the sript. sorry for wasting your time