Properly scale the placed element's material

pull/3/head
marcgauch 2023-12-29 19:18:04 +01:00
parent 16a9f846af
commit 84f6a7d690
2 changed files with 6 additions and 2 deletions

View File

@ -27,6 +27,12 @@ public class SimpleResizer
prefab.transform.localPosition = Vector3.zero;
prefab.transform.localRotation = Quaternion.identity;
// Marc Scale fix
// Calculate the texture scale based on the ratio of new size to default size
Vector2 textureScale = new Vector2(newSize.x / resizable.DefaultSize.x, newSize.y / resizable.DefaultSize.y);
prefab.GetComponent<Renderer>().material.mainTextureScale = textureScale;
// cleanup
MonoBehaviour.Destroy(resizable);
}

View File

@ -139,8 +139,6 @@ PlayerSettings:
bundleVersion: 0.1
preloadedAssets:
- {fileID: 11400000, guid: 29d72bf9f28086693968cedbdc8f08cd, type: 2}
- {fileID: 11400000, guid: 541751c4fa90967d68ef779a22ee43f3, type: 2}
- {fileID: -3127938587913570544, guid: 8eb28e39ec717d0799039f01965f0533, type: 2}
metroInputSource: 0
wsaTransparentSwapchain: 0
m_HolographicPauseOnTrackingLoss: 1