for some reason the debug code never activates:
using UnityEngine;
using System.Collections;
public class player_movement : MonoBehaviour {
private Rigidbody2D player;
private bool touching;
void Start()
{
player = GetComponent<Rigidbody2D>();
touching = true;
}
void OnCollisionEnter()
{
touching = true;
Debug.Log("enter");
}
void OnCollisionExit()
{
touching = false;
Debug.Log("exit");
}
void FixedUpdate ()
{
Debug.Log(Time.fixedTime + " " + touching);
if (Input.GetButtonDown("Jump") && touching == true)
{
player.AddForce(new Vector2(0,15000));
}
}
}
all it ever displays is true. i made sure that both objects have 2Drigidbodys
and colliders but it still doesn’t work.