Я привязал камеру к игроку, а она левее его! Персонаж находиться справа от камеры! А мне нужно что бы он был по середине!
Вот скрипт на камеру
using UnityEngine;
public class CamMove : MonoBehaviour
{
public GameObject player;
void Update()
{
transform.position = new Vector3 (player.transform.position.x, player.transform.position.y,-10f);
}
}
Вот скрипт на передвижение персонажа
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Controller : MonoBehaviour
{
int speed = 2;
int jump = 10;
Rigidbody2D rb;
void Start()
{
rb = GetComponent<Rigidbody2D>();
}
// Update is called once per frame
void Update()
{
rb.velocity = new Vector2(Input.GetAxis("Horizontal") * speed, rb.velocity.y);
if (Input.GetKeyDown (KeyCode.Space))
rb.AddForce (Vector2.up * 125);
}
}
Вот юнити

Мне надо так

А оно так