I have a script which procedurally moves placement objects (e.g. rocks with colliders) and decal projectors through the scene to always surround my player. Additionally I adjust the projection depth via script like so:
Vector3 size = decalProjector.size;
size.z = altitudeSpan + projectionDepthCushion * 2f;
decalProjector.size = size;
The actual projection depth gets adjusted and can be seen with its updated value in the inspector, however the bounds of the decal projector and thus the volume in which projection happens doesn’t update. For some reason the bounds extents also upwards, thus given the decal projector a pivot point which isn’t directly on the top face anymore but somewhere within the bounds. The first of the following 2 screenshots demonstrates incorrect bounds and how it looks after the script moved and resized the decal projector. The second screenshot demonstrates correct bounds which only get updated/invalidated once I change any property in the inspector.
After a script changed DecalProjector.size:
After I manually changed any Decal Projector property (and back):
Setup
- Windows 10 21H1 (Build 19043.1110)
- Unity 2020.3.5f1
- High Definition RP 10.4.0
Update #1
This is what I tried to far and that doesn’t solve the issue:
- changing the assignment order of DecalProjector.transform.position and DecalProjector.size
- setting other decal projector properties in order to invalidate the bounds/pivot