# Error when setting uScale after creating ground?

**URL:** <https://forum.babylonjs.com/t/error-when-setting-uscale-after-creating-ground/31726>\
**Category:** Questions\
**Created:** [June 27, 2022, 4:56pm UTC](https://forum.babylonjs.com/t/error-when-setting-uscale-after-creating-ground/31726 "2022-06-27T16:56:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![yjkhaoyun](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/yjkhaoyun/32/24190_2.png) [@yjkhaoyun](https://forum.babylonjs.com/u/yjkhaoyun)\
**Post date:** [June 27, 2022, 4:56pm UTC](https://forum.babylonjs.com/t/error-when-setting-uscale-after-creating-ground/31726/1 "2022-06-27T16:56:28Z")

</div>

The version numbers I use are:

```auto
"dependencies": {
    "@babylonjs/core": "^5.12.1",
    "@babylonjs/gui": "^5.12.1",
    "@babylonjs/loaders": "^5.12.1",

```

An attribute error occurred when I added a material to the ground, the code is as follows:

```auto
// Ground
     var ground = BABYLON.MeshBuilder.CreateGround("ground", { height: 50, width: 50, subdivisions: 4 }, scene);
     var groundMaterial = new BABYLON.StandardMaterial("groundMaterial", scene);
     groundMaterial.diffuseTexture = new BABYLON.Texture("textures/wood.jpg", scene);
     groundMaterial.diffuseTexture.uScale = 30;
     groundMaterial.diffuseTexture.vScale = 30;
     groundMaterial.specularColor = new BABYLON.Color3(.1, .1, .1);
     ground.material = groundMaterial;

```

Code taken from: [https://playground.babylonjs.com/#AHQEIB#17](https://playground.babylonjs.com/#AHQEIB#17)

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/f/a/fa2a29e240d1586e4f6b24c038f7e4f2c8dfec70.png)  
What is the reason for this please?

---

<div class="post-metadata">

**Author:** ![slin](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/slin/32/36084_2.png) [@slin](https://forum.babylonjs.com/u/slin)\
**Post date:** [June 27, 2022, 6:11pm UTC](https://forum.babylonjs.com/t/error-when-setting-uscale-after-creating-ground/31726/2 "2022-06-27T18:11:41Z")

</div>

@yjkhaoyun

It is a type error from typescript. uScale is not defined in BABYLON.BaseTexture, but in BABAYLON.Texture.

The problem is BABYLON.StandardMaterial has `diffuseTexture` defined as type BaseTexture in babylon.js source code. You can work around this typescript transpile time error with either:

```auto
const texture = new BABYLON.Texture("textures/wood.jpg", scene);
texture.uScale = 30;
texture.vScale = 30;
groundMaterial.diffuseTexture = texture;

```

or

```auto
groundMaterial.diffuseTexture = new BABYLON.Texture("textures/wood.jpg", scene);
(groundMaterial.diffuseTexture as BABYLON.Texture).uScale = 30;
(groundMaterial.diffuseTexture as BABYLON.Texture).vScale = 30;

```

---

<div class="post-metadata">

**Author:** ![yjkhaoyun](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/yjkhaoyun/32/24190_2.png) [@yjkhaoyun](https://forum.babylonjs.com/u/yjkhaoyun)\
**Post date:** [June 27, 2022, 11:50pm UTC](https://forum.babylonjs.com/t/error-when-setting-uscale-after-creating-ground/31726/3 "2022-06-27T23:50:05Z")

</div>

Thank you very much for your help, I solved the problem with this method 👍
