StaticBackground

From Unify Community Wiki
(Difference between revisions)
Jump to: navigation, search
(New page: This script allows you to have a static image as the background to your scene. Like a skybox that doesn't move. '''StaticBackground.cs''')
 
Line 2: Line 2:
  
 
'''StaticBackground.cs'''
 
'''StaticBackground.cs'''
 +
=== C# ===
 +
<csharp>
 +
// You can place this directly onto your camera.
 +
 +
using UnityEngine;
 +
 +
[ExecuteInEditMode]
 +
[AddComponentMenu("Image Effects/Static Background")]
 +
public class StaticBackground : MonoBehaviour {
 +
    public Texture2D background;
 +
 +
    [RenderBeforeQueues( 1000 )]
 +
    void OnRenderObject( int queueIndex ) {
 +
        if( background != null )
 +
            Graphics.Blit( background, RenderTexture.active );
 +
    }
 +
}
 +
</csharp>
 +
 +
 +
Feel free to ask me any questions regarding this script
 +
  -Ryan Scott-

Revision as of 10:00, 7 December 2009

This script allows you to have a static image as the background to your scene. Like a skybox that doesn't move.

StaticBackground.cs

C#

<csharp> // You can place this directly onto your camera.

using UnityEngine;

[ExecuteInEditMode] [AddComponentMenu("Image Effects/Static Background")] public class StaticBackground : MonoBehaviour {

   public Texture2D background;
   [RenderBeforeQueues( 1000 )]
   void OnRenderObject( int queueIndex ) {
       if( background != null )
           Graphics.Blit( background, RenderTexture.active );
   }

} </csharp>


Feel free to ask me any questions regarding this script

 -Ryan Scott-
Personal tools
Namespaces

Variants
Actions
Navigation
Extras
Toolbox