Search Unity

GUITexture is obsolete error

Discussion in 'Editor & General Support' started by ekimreed, Jul 26, 2021.

  1. ekimreed

    ekimreed

    Joined:
    Jul 26, 2021
    Posts:
    1
    I am getting the following error on load:
    Assets\MAPNAV\Scripts\InitScreen.cs(31,3):error CS0619:'GUITexture.pixelInset' is obsolete: 'GUITexture has been removed. Use UI.Image instead.'

    I have tried replacing GUITexture with UnityEngine.UI.Image as suggested but Image does not have a pixelInset method.

    Here is the implementation of GUITexture in the InitScreen.cs class:
    initBackg.GetComponent<GUITexture>().pixelInset = new Rect (initBackg.GetComponent<GUITexture>().pixelInset.x, initBackg.GetComponent<GUITexture>().pixelInset.y, Screen.width, Screen.height);

    Can anyone help/show me how to resolve this please?
    Thank you!

    Unity version 2021.1.15f1
    MapNav version 1.5.0
     
    alroy likes this.