Пример #1
0
    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;
        }
    }
Пример #2
0
 //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!");
     }
 }