Issues TextureWrapMode in WebGL

I’m having an issue with using TextureWarpMode in WebGL. I’m getting textures from a folder on a server and applying them to a game object. When the textures are applied they are “clamped” Ive added a line of code to set the textures to “Repeat”. This works fine when I’m testing it in the editor but but once its on the server the changes do not take effect.
Any help at all would be appreciated.

could you please be more specific? Are those textures in asset bundles? Does it work locally with Build&Run on WebGL?

No, the textures are not an asset bundle they’re Jpg’s in a folder. We cannot test it through Build&Run as the Webgl need to be on the server to load as it interacts with things on the server.

EDIT: I have attached the script for reference

    public void WrapMODE()
    {
        foreach(Material matt in objMaterials)
        {
            matt.mainTexture.wrapMode = TextureWrapMode.Repeat;
        }
    }




    //Button function to refresh chair materials
    public void TextLoad()
    {
        StartCoroutine(LoadText());
    }

    public void ReceiveServerCode(string sentCode)
    {
        serverCode = sentCode;
      //  codeText.GetComponent<Text>().text = serverCode;

        if(serverCode != "nocode")
        {
            StartCoroutine(LoadText());
        }

    }

    IEnumerator LoadText()
    {

        //while (true)
        //{
            //The URL of the web page where the textures are stored
            string materialsURL = "http://stills-development.co.uk/markup/fabrics/";
            //Start download of webpage
            //WWW guiwww = new WWW(serverCodeURL);
            //Wait for web page to be downloaded
            //yield return guiwww;

            //if (guiwww.error == null)
            //{
                //Reads web page as text
                //serverCode = guiwww.text.ToString();
                print("test" + serverCode);
                //Remove stars from code
                splitCode1 = serverCode.Split('*');
                print(splitCode1[1]);
                //Splitting received code by commas
                testSplitCode2 = splitCode1[1].Split(',');
                print(testSplitCode2[0]);
                List<string> test = testSplitCode2.ToList<string>();
                test.RemoveAt(4);
                  string[] splitCode2 = test.ToArray();
           //     Debug.Log(serverCode);




                //Initialising counter to determine which material array element is being created
                int counter = 0;



                foreach (string codePart in splitCode2)
                {
                    //Splitting code again to read material and texture
                    string[] splitCode3 = codePart.Split('/');
                    //Reading the chosen material from the code
                    Material chosenMaterial = Instantiate<Material>(originalMaterials.Find(mat => mat.name == splitCode3[0]));
                    //Downloading the chosen texture from the database
                    WWW tex = new WWW(materialsURL + splitCode3[1] + ".jpg");
                    yield return tex;

            texture = tex.texture;

                //  texture.wrapMode = TextureWrapMode.Repeat;
                    //Applying the chosen texture to the chosen material
                    chosenMaterial.mainTexture = texture;
                    print(counter.ToString());
                    //Adding the finished material to a materials array
                    objMaterials[counter] = chosenMaterial;
            //SetWrapMode for imported Texture


           // chosenMaterial.mainTexture.wrapMode = TextureWrapMode.Repeat;
          //  print("TEXWRAPMODE CALLED");



            //Incrementing counter
            counter++;

                }

          WrapMODE();
          print("WrapMODE CALLED");
        //Replacing the chairs material array with the newly generated one from above
        obj.GetComponent<Renderer>().materials = objMaterials.ToArray();
        //Add delay so as to not overload the system



                //Debug.Log(guiwww.text);
            //}

            //else
            //{
                //print(guiwww.error);
            //}

            //yield return new WaitForSeconds(1f);



        //}
           
    }

Hello deadmaggot1.

According to the GLES 2.0.24 $3.8.2: Non-power-of-two textures must have a wrap mode of CLAMP_TO_EDGE. Which means that repeat wrap mode can not be used in WebGL 1.0 if your texture is NPOT.

There are possible ways to workaround the issue:
a) Use a power-of-two texture.
b) Use a texture with mipmaps (in this case power-of-two behavior will be emulated internally by Unity)

You may also check related threads https://forum.unity3d.com/threads/texture2d-loadrawtexturedata-with-texturewrapmode-repeat-not-working.442424/ and https://forum.unity3d.com/threads/texture-display-problem-in-webgl.426955/

Thank you for your help. I will look into these.