Wednesday, December 6, 2023
HomeVisual EffectsIncluding a "Repair Now" button to supplies utilizing Amplify Shader

Including a “Repair Now” button to supplies utilizing Amplify Shader


Hey,

When utilizing a Unity default shader for particles, the fabric has a “Required Vertex Streams” part and a “Apply to Methods” button.

This characteristic could be very helpful for fixing any particle system that’s not set correctly.

How might I create such a button for a shader created with Amplify Shader Editor?


ASE has an choice to specify a “Customized Editor”. This allows you to override how the fabric is displayed within the inspector.

Right here’s the (restricted) official Unity documentation on the subject.

And right here’s the customized editor Unity’s particle shader makes use of. The “Apply to Methods” button is buried deep within the DoVertexStreamsArea() operate, seek for streamApplyToAllSystemsText to search out it.

Usually for a customized editor it’s a must to manually checklist out each materials property, and easy methods to show them. However you may also lengthen an current materials editor class, like ASE’s personal, and in your class’s OnGUI() operate it’s best to have the ability to name base.OnGUI(); to get the default ASE materials inspector, after which append your personal operate so as to add the vertex streams portion.

Sadly there’s no simple technique to generalize that operate, because the order and elements utilized by streams is bigoted based mostly on how you employ them in your particular shader. And thus typically needs to be hardcoded into the customized editor. Unity’s has an inventory of streams that it builds by taking a look at what options are enabled, and provides the suitable streams to the checklist within the specific order they’re wanted by the shader.



1 Like

Thanks a lot for this!

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments