How to create an invisible barrier?

Hello, I would like to create an invisible barrier and what has been behind this barrier because that is not only the “skybox”, let me explain better.
I want to create a spacecraft and put it behind the barrier that not only look to the pass it, so comes out as if he were invisible and appears from nowhere XD
not be if I understood.

Resumido: create a barrier and of above there is not can’t see(except the sky) but whatever is below if.

Because I want to create this bullshit?
I want to create a game they invade us the aliens that ships will passing the barrier appeared as if they had been invisible and now appear

You can check the position of your spacecraft and simply turn of the MeshRenderer when the spacecrafts position is behind the barrier. You could also change the opacity of the spacecraft through a shader.

The first method can be achieved with:


var Barrier:Transform;

function Update () {
	if(this.transform.position.z > Barrier.position.z){
		GetComponent(MeshRenderer).renderer.enabled = false;
	else {
		GetComponent(MeshRenderer).renderer.enabled = true;


using UnityEngine;
using System.Collections;

public class SpaceCraftScript : MonoBehaviour {

	public Transform Barrier;
	void Update () {
		if(transform.position.z > Barrier.position.z){
			GetComponent<MeshRenderer>().enabled = false;	
		else {
			GetComponent<MeshRenderer>().enabled = true;	

If you wanna learn more about the second method try reading this: