SetMaterial fails because SDK doesn't gather Materials from inactive GameObjects
naqtn
VRChat SDK doesn't gather Materials from SetMaterial action of inactive GameObjects to DynamicMaterials of VRC_SceneDescriptor.
Then, SetMaterial fails in some cases.
Reproduce step:
- Crate an GameObject, add VRC_Trigger, add OnInteract trigger, add SetMaterial action, select a material which doen't used by other objects.
- Open VRC_SceneDescriptor inspector, set size of DynamicMaterials to zero.
- Build and test the scene. It works fine. And now DynamicMaterials contains the material selected in step 1.
- Inactivate GameObject crated step 1.
- Again, open VRC_SceneDescriptor inspector, set size of DynamicMaterials to zero.
- Build and test the scene. This time, DynamicMaterials dosn't contain the material.
- Create another object, add VRC_Trigger, add OnInteract trigger, add SetGameObjectActive to change inactivated object above to active.
- Build and test the scene. Interact the object of step 7, then the object of step 1 appears, Interact that, Then it fails to SetMaterial.
Workaround:
Duplicate object of step 1, set active, hide to somewhere.
Log In