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
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

How to load a texture(background) from code?

Discussion in 'Scripting' started by ChaoticAngel-V, May 8, 2017.

  1. ChaoticAngel-V

    ChaoticAngel-V

    Joined:
    Mar 30, 2015
    Posts:
    6
    How to load a texture(background) from code? Is it possible to load a background for the scene with a string like you can with scenes?
     
  2. astracat111

    astracat111

    Joined:
    Sep 21, 2016
    Posts:
    719
    You can control almost anything in code, so it should be possible. Do you want to change the camera background or the skybox, or....?
     
  3. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,744
    If you need to load them by name from the project folder, you can use the Resources folder.

    If you need to load them from outside the project folder, use the UnityWebRequest class.
     
  4. ChaoticAngel-V

    ChaoticAngel-V

    Joined:
    Mar 30, 2015
    Posts:
    6
    The Panel background.