- Home /
Code editor doesnt work,My scripts dont work!
So i downloaded and used unity for the first time today, everything was working fine till i made a script, it opened visual studio by default, and i think i messed with when you open unity and click on the top right conrner under maximize, like a settings button. so i clicked there and messed with the "Unity editors folder" then i typed the method which goes like(you can find the code when u scroll down a bit) and the functions didnt offer autocomplete or anything of the sort, i thought my visual studio was not working fine so i just saved it and tried to run the game but when i clicked my Sprite it didnt change colors... Please how do i fix this?
{ using System.Collections; using System.Collections.Generic; using UnityEngine;
public class Bird : MonoBehaviour { private void OnMouseDown() {
GetComponent<SpriteRenderer>().color = Color.red;
}
} }
Answer by CodesCove · Aug 03, 2020 at 07:09 PM
Make sure the gameobject where your script and sprite is attached to has Collider component also. Otherwise it will not recognize your mouse click.
I did everything, but even without doing anything in the engine itself, shouldnt unity autocomplete in the code editor?
Your answer
Follow this Question
Related Questions
Next Scene not loading after all enemies are destoryed 0 Answers
How to send a reference to an instance 1 Answer
Input Field Characer Validation not changing 0 Answers
cannot implicitly convert type unityengine.vector3' to unityengine.transform' 1 Answer
Bullet in editor does not behave the same in build. 1 Answer