0
0
Unityframework~10 mins

Shader Graph basics in Unity - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create a new Shader Graph asset.

Unity
var shaderGraph = new ShaderGraph.[1]();
Drag options to blanks, or click blank then click option'
AAsset
BEditor
CGraph
DMaterial
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'Asset' instead of 'Graph' causes errors because ShaderGraph.Asset does not exist.
Using 'Material' confuses the shader with the material that uses it.
2fill in blank
medium

Complete the code to add a Color node to the Shader Graph.

Unity
var colorNode = new [1]Node();
Drag options to blanks, or click blank then click option'
AColor
BBoolean
CTexture2D
DVector1
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing 'Vector1' creates a float number node, not a color.
Choosing 'Texture2D' creates a texture node, not a color.
3fill in blank
hard

Fix the error in the code to connect the Color node output to the Base Color input of the Master node.

Unity
masterNode.[1]("BaseColor", colorNode.output);
Drag options to blanks, or click blank then click option'
ASetInput
BConnect
CLink
DBind
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'SetInput' causes errors because it does not exist.
Using 'Bind' or 'Link' are not valid methods in Shader Graph API.
4fill in blank
hard

Fill both blanks to create a Vector1 property and add it to the graph's properties.

Unity
var [1] = new Vector1Property();
graph.[2]([1]);
Drag options to blanks, or click blank then click option'
AmyFloat
BAddProperty
CAddNode
DfloatValue
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'AddNode' instead of 'AddProperty' causes the property not to be added.
Using invalid variable names causes syntax errors.
5fill in blank
hard

Fill all three blanks to create a simple shader graph that multiplies a color by a float and outputs it.

Unity
var color = new [1]Node();
var multiplier = new [2]Node();
masterNode.[3]("BaseColor", color.output * multiplier.output);
Drag options to blanks, or click blank then click option'
AColor
BVector1
CConnect
DMultiply
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'Multiply' as a method causes errors because it's not a method.
Mixing up node types causes runtime errors.