I know this has been asked before, but using all of the solutions I’ve found on this forum haven’t helped.
I’m very new to Unity, and just started following along with the Ruby 2D game tutorial. I have followed the instructions very precisely, and created the first script. Code is below
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RubyController : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
Vector2 position = transform.position;
position.x = position.x + 0.1f;
transform.position = position;
}
}
The name of the script is RubyController.cs
, so the name is correct.
This is what appears when I try to drag the file to the sprite (link to image: Screen-Shot-2020-08-17-at-11-14-41-PM hosted at ImgBB — ImgBB, image also attached as a file). Basically a pop up that says can’t add script, and in the inspector it says that there are no MonoBehaviour scripts in the file.
Please let me know what to do, this is driving me crazy. I am using Unity 2019.4.8f1 on a mac, and Visual Studio for mac. VS is not giving me any compile errors.