error CS1513: } expected but there is already unity code example
Example 1: error CS1513: } expected but there is already unity
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Player : MonoBehaviour
{
public float moveSpeed = 10f;
private Rigidbody2D rb;
// Start is called before the first frame update
void Start()
{
rb = GetComponent<Rigidbody2D>();
}
// Update is called once per frame
void Update()
{
//"A" - "-1"
//"D" = "1"
Vector3 movement -new Vector3(Input.GetAxis("Horizontal"), 0f, 0f);
transform.position += movement * Time.deltaTime * moveSpeed;
if (Input.GetkeyDown(keyCode.Space))
{
Jump();
}
void Jump()
{
rb.AddForce(new Vector2(0f, 5f), ForceMode2D.Impulse);
}
}
Example 2: error CS1513: } expected but there is already unity
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NewBehaviourScript : MonoBehaviour
public static float beklemeSuresi;
public GameObject resimObjesi;
void Start()
{
if (beklemeSuresi < 60)
{
beklemeSuresi += 2;
}
StartCoroutine(ResimGoster(beklemeSuresi));
}
IEnumerator bekle(float saniye)
{
resimObjesi.SetActive(true);
yield return new WaitForSeconds(saniye);
resimObjesi.SetActive(false);
}