Добрый день, у меня возникла проблема с кодом (c#) для спрайта beetle. Я несколько раз перепроверил свой код, но все равно мне выскакивает ошибка:
Assets\Scripts\Beetle.cs(42,9): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
Буду рад, если поможете)
Мой код:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Beetle : MonoBehaviour
{
public float speed = 4f;
bool isWait = false;
bool isHidden = true;
public float waitTime = 4f;
public Transform point;
void Start()
{
point.transform.position = new Vector3(transform.position.x, transform.position.y + 1f, transform.position.z);
}
void Update()
{
if (isWait == false)
transform.position = Vector3.MoveTowards(transform.position, point.position, speed*Time.deltaTime);
if (transform.position == point.position)
{
if (isHidden)
{
point.transform.position = new Vector3(transform.position.x, transform.position.y + 1f, transform.position.z);
isHidden = false;
} else
{
point.transform.position = new Vector3(transform.position.x, transform.position.y - 1f, transform.position.z);
isHidden = true;
}
isWait = true;
StartCoroutine(Waiting());
}
}
IEnumerator Waiting()
{
yield return new WaitForSeconds(waitTime);
isWait == false;
}
}