how do I set a static Texture?

I’m trying to set a Texture in a script modified to be a database. How do I set the Static variable? I know textures can be set in the inspector by looking at the script itself but statics don’t come up in either the transform or the script. (as far as I am aware) I’m just trying to set the static to be referenced elsewhere.

Do this:
Declare 2 vars;

  1. var textur : Texture;
  2. public static var textur2 : Texture;
    In Start() function
    insert this :
    textur2=textur;

Now the texture you assinged via inspector in var textur is dublicated in textur2 which is a static var ready to pass it to any other script.

Hope i was helpful. :smiley:

If I have understood correctly you want to set your static Texture through the insepctor. That is not possible because static variables are not shown in the inspector. Your choices are:

If you follow last option you could make a class like this:

public class TextureThroughInspector : MonoBehaviour{
		public Texture textureNonStatic;
		public static Texture texture;

		void Start(){
			texture = textureNonStatic;
		}
	}

However that is a bad practice because the non-static texture should be made private, and also there wouldn´t be any need to make it a child of MonoBehaviour, I only did it so you can set it through the inspector.

I think the best you could do is implementing a good singleton solution while loading the texture from a local file (no need of using inspector here).