# Why can't I use "material.diffuseTexture.uScale" property?

**URL:** <https://forum.babylonjs.com/t/why-cant-i-use-material-diffusetexture-uscale-property/32200>\
**Category:** Questions\
**Created:** [July 15, 2022, 7:18am UTC](https://forum.babylonjs.com/t/why-cant-i-use-material-diffusetexture-uscale-property/32200 "2022-07-15T07:18:31Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![nao](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/nao/32/25667_2.png) [@nao](https://forum.babylonjs.com/u/nao)\
**Post date:** [July 15, 2022, 7:18am UTC](https://forum.babylonjs.com/t/why-cant-i-use-material-diffusetexture-uscale-property/32200/1 "2022-07-15T07:18:31Z")

</div>

Hi I’m new to babylon.js and I’m trying the official tutorial.

I’m testing this([https://playground.babylonjs.com/#20OAV9#25](https://playground.babylonjs.com/#20OAV9#25)) in my local environment, but as I mentioned in the title, I got errors like “Property ‘uScale’ does not exist on type ‘BaseTexture’. Did you mean ‘scale’?” for these parts:

```auto
mat1.diffuseTexture.uScale = 2;
mat1.diffuseTexture.vScale = 4;
// ...
mat2.diffuseTexture.uOffset = 0.25;
mat2.diffuseTexture.vOffset = 0.5;

```

Actually, I’ve received the same errors before.  
What makes them?

I’d like your help please!

---

<div class="post-metadata">

**Author:** ![nogalo](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/nogalo/32/120_2.png) [@nogalo](https://forum.babylonjs.com/u/nogalo)\
**Post date:** [July 15, 2022, 7:45am UTC](https://forum.babylonjs.com/t/why-cant-i-use-material-diffusetexture-uscale-property/32200/2 "2022-07-15T07:45:47Z")

</div>

Hey. This is not telling much. In theory this should work. We will probably need more info to figure it out. Can you share your code somehow? How are you defining textures and materials in your local environment. Maybe even version of Babylon.

If you look at the properties of BaseTexture though. There is indeed no uScale and vScale, but why you end up with BaseTexture is the question 😃

> **[BaseTexture | Babylon.js Documentation](https://doc.babylonjs.com/typedoc/classes/BABYLON.BaseTexture)**
>
> Base class of all the textures in babylon.It groups all the common properties the materials, post process, lights... might needin order to make a co \[

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [July 15, 2022, 12:01pm UTC](https://forum.babylonjs.com/t/why-cant-i-use-material-diffusetexture-uscale-property/32200/3 "2022-07-15T12:01:01Z")

</div>

`material.diffuseTexture` is of type BaseTexture, and I can only assume you have made the right decision and are using typescript 🙂 Which is the main issue here (or better - it is the difference between the playground and your code).

The properties are there, since you have defined the diffuseTexture yourself), but typescript doesn’t recognize them.

What you can do is change the uScale of the texture you have created and not of the assigned diffuseTexture. something like this:

```javascript
const texture = new Texture(....)
texture.uScale - 2

mat1.diffuseTexture = texture;

```

---

<div class="post-metadata">

**Author:** ![nao](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/nao/32/25667_2.png) [@nao](https://forum.babylonjs.com/u/nao)\
**Post date:** [July 15, 2022, 1:28pm UTC](https://forum.babylonjs.com/t/why-cant-i-use-material-diffusetexture-uscale-property/32200/4 "2022-07-15T13:28:02Z")

</div>

Thank you all for your reply very much.  
I tried it like RaananW showed and it fixed the issue!

Are you saying that in typescript, there is no such thing as uScale property for diffuseTexture?

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [July 15, 2022, 1:33pm UTC](https://forum.babylonjs.com/t/why-cant-i-use-material-diffusetexture-uscale-property/32200/5 "2022-07-15T13:33:55Z")

</div>

typescript is type safe. it means that if you don’t case and we define that a certain variable is of a certain type, this is the type the property will be checked against.

Gosh, what a sentence… sorry.

material.diffuseTexture is a BaseTexture.  
The Texture you have created is of type Texture, which extends BaseTexture.  
Texture has uScale, BaseTexture does not.  
Type-safety-wise, material.diffuseTexture does not have uScale. But if you set it to be of type Texture, the original class can have uScale set, since it is of the right type.

---

<div class="post-metadata">

**Author:** ![nao](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/nao/32/25667_2.png) [@nao](https://forum.babylonjs.com/u/nao)\
**Post date:** [July 15, 2022, 1:39pm UTC](https://forum.babylonjs.com/t/why-cant-i-use-material-diffusetexture-uscale-property/32200/6 "2022-07-15T13:39:11Z")

</div>

I think I understand!  
Thank you for explaining it in detail, it really helped me. 😄
