Mail.ruПочтаМой МирОдноклассникиВКонтактеИгрыЗнакомстваНовостиКалендарьОблакоЗаметкиВсе проекты

Появляется ошибка error CS1519: Invalid token ';' in class, record, struct, or interface member declaration в Unity

Лев Дударев Ученик (159), закрыт 2 года назад
Хочу сделать управление для объекта, но появляется ошибка 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;
}
}
}
Лучший ответ
temka game killer Мыслитель (7370) 2 года назад
Попробуйте так.

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

public class up : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{

}

// Update is called once per frame
void Update()
{
if (Input.GetKey(KeyCode.Space))
{
GetComponent<Rigidbody>().AddForce(Vector3.up/3, ForceMode.Impulse);

}
}
}

Создайте куб GameOdject-> 3dObject- > Cube
Чтобы кубик вниз не проваливался. Создайте Terrain Gameobject->3dObject->Terrain. Чтобы правильно установить камеру. выделите камеру MainCamera во вкладке Hierachy наведите камеру на кубик и нажмите GameOdject -> Aling to View.. И перенесите скрипт "Up" на кубик
Остальные ответы
Никита Урцев Ученик (102) 2 года назад
помогите вот мой код

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
Похожие вопросы