Skip to content

Instantly share code, notes, and snippets.

@kuetsuhara
Created April 3, 2014 10:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kuetsuhara/9952286 to your computer and use it in GitHub Desktop.
Save kuetsuhara/9952286 to your computer and use it in GitHub Desktop.
public void Change( Material skybx ){
// 表示されているmeshを削除
GameObject[] examples = GameObject.FindGameObjectsWithTag("SkyMesh");
for( int i = 0; i < examples.Length; i++){
Destroy(examples[i]);
}
// 新たにメッシュを設定
this.material = null;
this.skybox = null;
skybox = skybx;
Debug.Log ("Hey" + skybox);
if( this.material == null ) {
this.material = new Material( _shaderText );
}
if(mesh == null ){
Debug.Log("mesh :: " + mesh);
mesh = _CreateMesh();
}
_CreatePlane( mesh, "_FrontTex", Quaternion.identity );
_CreatePlane( mesh, "_LeftTex", Quaternion.Euler( 0.0f, 90.0f, 0.0f ) );
_CreatePlane( mesh, "_BackTex", Quaternion.Euler( 0.0f, 180.0f, 0.0f ) );
_CreatePlane( mesh, "_RightTex", Quaternion.Euler( 0.0f, 270.0f, 0.0f ) );
_CreatePlane( mesh, "_UpTex", Quaternion.Euler( -90.0f, 0.0f, 0.0f ) );
_CreatePlane( mesh, "_DownTex", Quaternion.Euler( 90.0f, 0.0f, 0.0f ) );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment