I copypasted that code and it works fine, assuming it’s in a MonoBehaviour class. Not sure what you mean by “trying to override OnCollisionEnter()” though.
thnx Bren ya i had an another class named Collison in a different script but i renamed it to something else and it worked.
Finally i made my cheap portal in unity demo working will post a video in sometime. (I just followed twisted brothers tutorials and made a small game app and implemented portals just for fun)