The task is to change the size of StaticMesh from C++.
There is base C++ class. StaticMesh is choosed from BP class.
I want to use the same BP for different sizes.
From Blueprints I can do it here (see picture). Is it possible to do the same from C++ for one copy only? Or advise the way to do it proper. Textures should not be resized.
Not Sure exactly what you want, why don’t you simply scale the component ? (UStaticMeshComponent)
staticMesh->SetWorldScale3D(FVector(2, 2, 2));
staticMesh->SetRelativeScale3D(FVector(2, 2, 2));
In that case textures on the edges are stretched also.
You could change the material so that the edges won’t stretch.
Now i know what you whant, I would recommend you to do it in material to avoid having to manually code dynamic scaling.
Material has a TextCood node, multiply it with the object scale node and ‘voila’
You should keep a correct scale ratio. but i don’t think there is a magic solution for that case
Yes. Thank you.
I can’t do exactly the same.
I have to use one BP material.
There are 3 materials (one for opposite sides of a cube).
DataAsset contains size scale, material and other information.
Using C++ I can change any scale of the cube and adjust UVs in BP already.