How to get skyboxes to change on collision with plane? Javascript Please help me!

Hi there everyone,

Me and my friend are hoping to piece together a short indie game between us. We want the day and night to change when the player collides with another plane (So its day in the beach and night in the forest for example). This is the script I’m trying to use:

`

</b><b></b>

var mat:Material;


<b></b><b></b><b>

function OnTriggerEnter(trigger: Collider){


</b><b></b><b></b>

RenderSettings.skybox=mat;

}
`

I apply this to the beach plane and nothing happens. I have also tried making the graphics for the first person camera a rigidbody and that doesnt help either. I also tried changing the script to:

``` ````

var mat:Material;

``

function OnTriggerEnter(trigger: Collider){

````

Debug.Log("Hello World!");

}
`

And this doesn't log "Hello World!" on collision either. Anybody got any ideas on making this work? Its made me look a bit lazy because this script is my responsibility. I have spent hours trying alternatives and this seems the most likely to work out of any. Who thought such a simple script could cause so much trouble? I am quite literally at tether's end with this and I really hope somebody can help me out

Thank you for any help

Matthew

There’s another solution without actually messing with skybox however it’s very straight forward.

  1. Copy the scene, so you’ll have two scene now. 1 for the beach and 1 for the forest.

  2. When the player hits the collider, just run the

    Application.LoadLevel(“Forest”);

Each scene contains all the same thing, that’s why you save scene as, just the different is the skybox.