For some reason my script won’t do anything, i use Visual studio (if it matters). Unity shows an unedited code when i click on the script, which would explain why its not doing anything. But why is Unity ignoring what i put in Visual studio? I cannot do anything for my game because Unity ignores everything i write (don’t know if this matters, but when i click new script i don’t get to choose what language to use). Any help is appreciated.
Silly question but did you remember to save the changes to your script in Visual Studio?
This is because Unity only supports one scripting language, C#. The other languages were discontinued.
There is only one language in Unity now. It’s c#.
If you have compiler errors, Unity will not finish compiling. It’s also possible you don’t have auto refresh on, which forces Unity to recompile when you return to Unity.
I did remember to save my script, is there something I need to add to Visual studio?
Also, i figured it was the only language now but I wanted to make sure.
Like @Brathnann said Unity won’t pick up any changes if there are any compile errors anywhere in your project. Does the Unity console have any error messages in it?
No, the console is empty.
Post your script
1 using UnityEngine;
2 public class playerMovement : MonoBehaviour{
3
4 public Rigidbody rb;
5
6
7 // Start is called before the first frame update
8 void Start()
9 {
10 rb.useGravity = False;
11 }
12
13 // Update is called once per frame
14 void Update()
15 {
16
17 }
18}
19
Its not really supposed to do anything except for disabled gravity as a test
Is the script attached to an active GameObject? Is the “rb” property assigned?
It should be, rb refers to the Rigidbody which should be assigned to the “player”
Even if it isn’t, thats just my current script. Unity also wouldn’t even do a Debug.Log
Post a screenshot of your editor window with the object selected that has this script attached.
I got it to work, I had to change my preferences to use Visual studio. I didn’t know I had to do that. Thank you for the help