Engine-Dependent Material | Blender 4.0 (Eevee and Cycles)
Description
A proof-of-concept for a material shader that changes based on what render engine is enabled.
The setup creates custom scene properties that detect whether Cycles or Eevee is enabled. While the bundled file here only supports those two engines, in theory, the script can be extended to detect any render engine.
Installation
The download comes with .blend file containing an example material and the Python code needed to construct the necessary view layer properties. The code could either be ran directly from the text editor, or installed as an add-on.
Note: The script has to be ran every time Blender is opened since the created properties get cleared upon closing. Installing the script as an add-on avoids this problem by automatically running the code during startup.