Ошибка в юнити Assets\Script\Controller.cs(49,13): error CS1520: Method must have a return type
Помогите решить пж
Елена Доркина
Ученик
(205),
на голосовании
8 месяцев назад
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement;
public class Controller : MonoBehaviour { Rigidbody2D rb;
public float jumpForce, speed; public Transform groundCheck; public LayerMask layerGround; public float horizontalspeed; // Start is called before the first frame update void Start() { rb = GetComponent<Rigidbody2D>(); Input.multiTouchEnabled = true; }
public void LeftButtonDown() { speed = -horizontalspeed; }
public void RightButtonDown() { speed = horizontalspeed; }
public void Stop() { speed = 0; }
public void Jump() { if (Physics2D.OverlapCircle(groundCheck.position, 0.1f, layerGround)) rb.velocity = new Vector2(rb.velocity.x, jumpForce); }
// Update is called once per frame void FixedUpdate() { rb.velocity = new Vector2(speed, rb.velocity.y); }
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class Controller : MonoBehaviour
{
Rigidbody2D rb;
public float jumpForce, speed;
public Transform groundCheck;
public LayerMask layerGround;
public float horizontalspeed;
// Start is called before the first frame update
void Start()
{
rb = GetComponent<Rigidbody2D>();
Input.multiTouchEnabled = true;
}
public void LeftButtonDown()
{
speed = -horizontalspeed;
}
public void RightButtonDown()
{
speed = horizontalspeed;
}
public void Stop()
{
speed = 0;
}
public void Jump()
{
if (Physics2D.OverlapCircle(groundCheck.position, 0.1f, layerGround))
rb.velocity = new Vector2(rb.velocity.x, jumpForce);
}
// Update is called once per frame
void FixedUpdate()
{
rb.velocity = new Vector2(speed, rb.velocity.y);
}
private OnTriggerEnter2D(Collider2D other)
{
if (other.tag == "Respawn")
{
SceneManager.LoadScene(0);
}
}
}