Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

OnCollisionEnter not working

Discussion in 'Scripting' started by chestersbusy, Nov 30, 2017.

  1. chestersbusy

    chestersbusy

    Joined:
    Nov 30, 2017
    Posts:
    15
    I am working in C# and my console does not display the text when I hit an Object. Please Help




    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;

    public class PlayerCollision : MonoBehaviour {

    void OnCollisionEnter (){
    Debug.Log ("We hit something.");
    }
    }
     
  2. ThermalFusion

    ThermalFusion

    Joined:
    May 1, 2011
    Posts:
    906
    chestersbusy likes this.
  3. chestersbusy

    chestersbusy

    Joined:
    Nov 30, 2017
    Posts:
    15
    It did not. Thanks for your help its now solved
     
  4. colbyjacob8

    colbyjacob8

    Joined:
    Nov 28, 2017
    Posts:
    10
    When posting use the code brackets for code so its easier to read.