using System.Collections;using System.Collections.Generic;using UnityEngine;public class script : MonoBehaviour{ [SerializeField] float speed; Rigidbody2D rb; Vector2 moveVelocity; // Start is called before the first frame update void Start() { rb = GetComponent(); } // Update is called once per frame void Update() { } private void FixedUpdate() { Move(); } void Move() { Vector2 moveInput = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical")); moveVelocity = moveInput.normalized * speed; rb.MovePosition(rb.position + moveVelocity * Time.fixedDeltaTime); }}
Для чего нужен и почему появляеться DontDestroyOnLoad?