Setting texture wrap mode from script

I want to set Texture2D wrap mode to Repeat from script. Unfortunately this does not seem to work.

            fillTexture.wrapMode = TextureWrapMode.Repeat;
            fillTexture.Apply();
            EditorUtility.SetDirty(fillTexture);
            AssetDatabase.SaveAssets();

Texture will be for a short time in Repeat mode indeed, but then after reloading scene it will be shown in Clamp. It is in clamp mode in Editor.

What am i doing wrong? At first i tried only the first line of this code, but it does not work too.

Do you find it? @maltakereuz

Very old post, but I came upon it while looking for the answer, so there are likely others in the same boat. The above code should work now, as this code worked for me:

destinationTexture.wrapMode = TextureWrapMode.Clamp;
destinationTexture.Apply ();

I hope that helps.