engine icon indicating copy to clipboard operation
engine copied to clipboard

[DOCS] add documentation for Material.clearVariants

Open aidinabedi opened this issue 2 months ago • 4 comments

Description

This PR documents the method clearVariants in Material.

Checklist

  • [x] I have read the contributing guidelines
  • [x] My code follows the project's coding standards
  • [x] This PR focuses on a single change

aidinabedi avatar Oct 31 '25 00:10 aidinabedi

What use case do you have that needs this to be public? Currently it's internal function, and clears variants as needed, without you having to do it manually.

mvaligursky avatar Oct 31 '25 10:10 mvaligursky

Did not know about this method, and it actually pretty useful in case when updating global shader chunks, and need to force material shader updates.

Maksims avatar Oct 31 '25 11:10 Maksims

What use case do you have that needs this to be public? Currently it's internal function, and clears variants as needed, without you having to do it manually.

@mvaligursky We need to call it in cases when we inherit pc.Material to create our own "smart" material like pc.StandardMaterial, which generate dynamic shader code based on material properties.

aidinabedi avatar Oct 31 '25 12:10 aidinabedi

Did not know about this method, and it actually pretty useful in case when updating global shader chunks, and need to force material shader updates.

In this case, you just call material.update();

mvaligursky avatar Nov 04 '25 14:11 mvaligursky