Assets\Script\PlayerCollision.cs(3,14): error CS0101: The namespace '<global namespace>' already contains a definition for 'PlayerCollision'
Witam oto taki problem podany wyżej się pojawia niżej podam kod w którym wyskakuje błąd;
using UnityEngine;
public class PlayerCollision : MonoBehaviour
{
public PlayerMoments Movment;
void onColisionEnter(Collision collisionInfo)
{
//Debug.Log(collisionInfo.collider.name);
if(collisionInfo.collider.tag == "Cube")
{
// Debug.Log("we hit in Cube");
Movment.enabled = false;
FindObjectOfType<ManagerGame>().EndGame();
}
}
}
Tutaj wklejam inne kody znajdujące się w programie może się przydadzą.
using UnityEngine;
public class PlayerMoments : MonoBehaviour {
public Rigidbody br;
public float forwardForce = 2000f;
public float sidewaysForce = 500f;
// Start is called before the first frame update
// Update is called once per frame
void FixedUpdate()
{
br.AddForce(0, 0, forwardForce * Time.deltaTime);
if(Input.GetKey("d")) // komenda na wprowadzenie ruchu w tynm przpyadku d
{
br.AddForce(sidewaysForce * Time.deltaTime, 0 ,0, ForceMode.VelocityChange);
}
if(Input.GetKey("a")) // komenda na wprowadzenie ruchu w tynm przpyadku a
{
br.AddForce(-sidewaysForce * Time.deltaTime, 0 ,0, ForceMode.VelocityChange); // miunus oznacza w przeciwnym kierunku do d
}
}
}
using UnityEngine;
public class ManagerGame : MonoBehaviour
{
public void Update()
{
Debug.Log("Game Over");
}
}
using UnityEngine;
public class FollowPlayer : MonoBehaviour
{
public Transform player;
public Vector3 offset;
void Update()
{
transform.position = player.position + offset;
}
}
using UnityEngine;
using UnityEngine.UI;
public class Score : MonoBehaviour
{
public Transform player;
public Text tscore;
// Update is called once per frame
void Update()
{
//Debug.Log(player.position.z);
tscore.text = player.position.z.ToString("0");
}
}
Jeżeli będzie potrzeba to wrzucę linki do ss z programu.