Problem with collisioncode (C#)

Updated on May 10, 2017 in Unity
Share on Facebook0Tweet about this on TwitterShare on Google+0Share on Reddit0
6 on May 9, 2017

I have this problem:

Im getting errors in my code


using UnityEngine.SceneManagement;

using UnityEngine;
public class Collision : MonoBehaviour {
void OnCollisionEnter (Collision collisionInfo)

{

if (collisionInfo.collider.tag == "Obstakel")

{

SceneManager.LoadScene (SceneManager.GetActiveScene ().name);

}

}

void Restart ()

{

SceneManager.LoadScene (SceneManager.GetActiveScene().name);

}

}

The errors:
UnityEngine.Componement.collider’ is obsolete: ‘Property collider has been deprecated. Use GetComponement<Collider>() instead.

Hope ill get a good answer!

Bye bye

-Justus

  • Liked by
  • CodeJustus
Reply
2 on May 9, 2017

Please tell me you are using UnityEngine in this code and just forgot to copy it.

Helpful
on May 9, 2017

If you have that then you are trying to call some code that doesn’t exist.

on May 10, 2017

I have iT in my code

Show more replies
  • Liked by
Reply
Cancel
2 on May 10, 2017

Have you read the error? It says exactly what’s wrong and how to fix it

on May 10, 2017

In not english so….

Guru
on May 10, 2017

If you’re unable to read English on a decent level. I’d recommend you to start learning since English is a pretty big part of programming.

Show more replies
  • Liked by
Reply
Cancel