I’m trying to set the bounds of a mesh to a tunable value at runtime.
However the bounds are not changing at all.
My Mesh is Read/Write.
I am testing the culling with a occlusion culled camera.
I’m on Unity3d 5.5.0p4
void Update()
{
SkinnedMeshRenderer SMR = GetComponent<SkinnedMeshRenderer>();
Debug.Log("Old Bounds " + SMR.bounds.ToString());
Bounds B = new Bounds(center, extents * 2f);
SMR.sharedMesh.bounds = B;
Debug.Log("New Bounds " + SMR.bounds.ToString());
}
I can edit the Center and Extents in the Inspector, but I want to be able to set the bounds at Runtime so I can guarantee the meshes have a consistent Bounds.
It’s like the Setter function is broken.
Has anyone else run into this problem, or know a fix? Do I need to set these values in a different step before Update or LateUpdate?
Thanks man, I've been looking for days and your simple comment finally solved my issue!
– RussellinhoI tried using jdk8 and the error persisted...
– Sophung