- Home /
Some materials doesn't load the new texture on playtime while others do. Im changing the material´s texture directly from script.
So im changing textures from the game materials with scripts (im adding the materials and textures in arrays of public variables in a script) changing it "manually". But on run time only some objects that use that material change while other change until i reload the scene. What can i do to "force" al materials to update their texture on any object on the scene? I checked all of the properties of the textures, and their shaders but i cant figure out why its not working with all materials.
Answer by hameed-ullah-jan · Apr 04, 2019 at 05:33 AM
declare those materials and textures public in your script, and pass those materials and textures from the Project view, not the hierarchy menu. Let me explain a bit, do not drag the gameobject to the inspector's material variable that you declared, drag the material and textures from the project view. This way it will affect all the game objects.
Thanks, I´ve already dragged the materials and textures from the project menu since the beginning, some materials update on run time and others when I reload the scene.