Появляется ошибка error CS1519: Invalid token ';' in class, record, struct, or interface member declaration в Unity
Хочу сделать управление для объекта, но появляется ошибка error CS1519: Invalid token ';' in class, record, struct, or interface member declaration
код:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Player : MonoBehaviour
{
[SerializeFiled] keyCode keyOne;
[SerializeField] Vector 3 moveDirection;
private void FixedUpdate()
{
if (Input.GetKey(keyOne))
{
GetComponent<Rigidbody>().velocity += moveDirection;
}
}
}
помогите пожалуйста делаю по видео всё правильно вот мой код == using System.Collections; using System.Collections.Generic; using UnityEngine; public class playercontroller : MonoBehaviour { public float speed; public float JumpForce; private float moveInput; private Rigidbody2D rb(); { rb = getcomponent<Rigidbody2D>(); } private void FixedUpdate(); rb.velocity = new Vector2(moveInput * speed, rb.velocity.y); } я его не дописал как и ютубер но у него работает а меня нет ошибка -
Assets\script\playercontroller.cs(12,5): error CS1519: Invalid token '{' in class, record, struct, or interface member declaration
Assets\script\playercontroller.cs(13,12): error CS1519: Invalid token '=' in class, record, struct, or interface member declaration
Assets\script\playercontroller.cs(13,39): error CS1519: Invalid token '(' in class, record, struct, or interface member declaration
как решить? помогите плис хоть я и новичок но в коду немного разбираюсь а в ошибках - no no no ну короче помогите пожалуйста бесит эти ошибки а потом мне все обьекты юнити удалит
помогите вот мой код
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using GoogleMobileAds.Api;
public class RewAd : MonoBehaviour
{
private string RewardedUnityId = "ca-app-pub-3940256099942544/5224354917";
private RewardedAd = rewardedAd;
private void OnEnable()
{
rewardedAd = new RewardedAd(RewardedAdUnityId);
AdRequest adRequest = new AdRequest.Builder().Build();
rewardedAd.LoadAd(adRequest);
rewardedAd.OnUserEarnedReward += HandleUserEarnedReward;
}
private void HandleUserEarnedReward(object sender, Reward e)
{
int money = PlayerPrefs.GetInt("money");
money += 3 ;
PlayerPrefs.SetInt("money", money);
}
public void ShowAd()
{
if(rerewardedAd.IsLoaded())
rewardedAd.Show();
}
}
выдает 2 ошибки
эту - Assets\Scripts\RewAd.cs(10,36): error CS1519: Invalid token ';' in class, struct, or interface member declaration
и эту - Assets\Scripts\RewAd.cs(10,24): error CS1519: Invalid token "=" in class, struct, or interface member declaration