Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Create GUI Texture without drag&drop(programatically)

Discussion in 'Immediate Mode GUI (IMGUI)' started by norba, Feb 24, 2019.

  1. norba


    Dec 1, 2015
    Yes, I know that GUI textures are deprecated but I'm working on an old project and when I import the project into Unity 2017.3, some links to GUI textures break and I need to add them manually.
    So I have a Prefab which has a GUI texture field like this:
    Code (CSharp):
    1. public GUITexture menu;
    which could be set by drag&drop in the editor if the prefab was added to a scene by drag&drop. But, I create the Prefab programatically(the Prefab is loaded with Resources.Load(path)). My question is how can I set the GUI texture programatically because drag&drop does not work on a non-scene object/texture?