Search Issue Tracker

By Design

Votes

0

Found in [Package]

2021.2.0a9

2021.2.0b11

2022.1

Issue ID

1366095

Regression

Yes

Custom Function Node with Type > File mode does not use function from within the referenced file

Package: Shader Graph

-

Steps to reproduce:
1. Create a new HDRP project
2. Right-click in Project > Assets then click Import Package > Custom Package... then select attached "SwitchColorOnDefine.unitypackage", then click Import
3. Enter Play Mode

Expected result: both spheres are green
Actual result: one sphere is red and another one is green

Reproducible with: 12.0.0 (2021.2.0a9, 2021.2.0b12, 2022.1.0a10), 13.0.0 (2022.1.0a11)
Not reproducible with: 10.6.0 (2020.3.19f1), 10.7.0 (2020.3.19f1), 11.0.0 (2021.1.21f1), 12.0.0 (2021.2.0a8)
Couldn't test with: 2019.4.31f1 - due to package importing errors

  1. Resolution Note:

    So the file type is still used with a custom function node. However, this workaround for adding in a define will not work since the include file for the SwitchColorOnDefine happens earlier than the vertex function actually #define's the ONCOLOR. A long term fix for this would potentially be allowing users to decide where exactly includes are placed in custom function nodes, which is something we have in mind. A short term fix would be to move the define function done in the custom function node to a file rather (rather than the string custom function it is now) so that the include pastes in the define before the switchoncolor function checks the #ifdef (I have verified that this makes the ball render green). Since this is not actually a bug though, closing.

Add comment

Log in to post comment