//! @return	the static instance of the VideoTextureManager (lazily initialized)
    public static VideoTextureManager GetInstance()
    {
        if (s_instance == null)
        {
            GameObject go = new GameObject();
            s_instance = go.AddComponent<VideoTextureManager>();
            go.name = typeof(VideoTextureManager).FullName;
        }

        return s_instance;
    }
    //! @return	the static instance of the VideoTextureManager (lazily initialized)
    public static VideoTextureManager GetInstance()
    {
        if (s_instance == null)
        {
            GameObject go = new GameObject();
            s_instance = go.AddComponent <VideoTextureManager>();
            go.name    = typeof(VideoTextureManager).FullName;
        }

        return(s_instance);
    }
    void OnWillRenderObject()
    {
        switch (m_textureType)
        {
        case TextureType.Renderer:
            m_material.mainTexture = VideoTextureManager.GetInstance().GetTexture();
            break;

        case TextureType.GUITexture:
            m_guiTexture.texture = VideoTextureManager.GetInstance().GetTexture();
            break;

        default:
            break;
        }
    }
 //initialization
 void Start()
 {
     // Assign texture to the renderer
     if (renderer != null)
     {
         m_textureType          = TextureType.Renderer;
         m_material             = renderer.material;
         m_material.mainTexture = VideoTextureManager.GetInstance().GetTexture();
         m_material.color       = new Color(1.0f, 1.0f, 1.0f, 1.0f);
     }
     else if (guiTexture != null)
     {
         // or gui texture
         m_textureType        = TextureType.GUITexture;
         m_guiTexture         = guiTexture;
         m_guiTexture.texture = VideoTextureManager.GetInstance().GetTexture();
         m_guiTexture.color   = new Color(1.0f, 1.0f, 1.0f, 1.0f);
     }
     else
     {
         m_textureType = TextureType.None;
         //Debug.Log("Game object has no renderer or gui texture to assign the generated texture to!");
     }
 }
 void OnDestroy()
 {
     s_instance = null;
 }
 void OnDestroy()
 {
     s_instance = null;
 }