0
0
Unityframework~10 mins

Materials and textures 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 material with a shader.

Unity
Material mat = new Material(Shader.[1]("Standard"));
Drag options to blanks, or click blank then click option'
AFind
BLoad
CCreate
DGet
Attempts:
3 left
💡 Hint
Common Mistakes
Using Shader.Create instead of Shader.Find causes errors because Create does not exist.
Using Shader.Load is incorrect because shaders are not loaded that way.
2fill in blank
medium

Complete the code to assign a texture to the material's main texture slot.

Unity
mat.[1] = myTexture;
Drag options to blanks, or click blank then click option'
ASetTexture
Btexture
CmainTexture
DGetTexture
Attempts:
3 left
💡 Hint
Common Mistakes
Using SetTexture is a method that requires a property name, not a direct assignment.
Using GetTexture is for retrieving, not setting.
3fill in blank
hard

Fix the error in the code to change the color of the material.

Unity
mat.color = new Color([1], 0.5f, 0.5f);
Drag options to blanks, or click blank then click option'
Atrue
B255
C"red"
D1.0f
Attempts:
3 left
💡 Hint
Common Mistakes
Using 255 causes the color to be invalid.
Using a string or boolean is not valid for color components.
4fill in blank
hard

Fill both blanks to create a material and assign a texture property by name.

Unity
Material mat = new Material(Shader.[1]("Standard"));
mat.[2]("_MainTex", myTexture);
Drag options to blanks, or click blank then click option'
AFind
BSetTexture
CGetTexture
DCreate
Attempts:
3 left
💡 Hint
Common Mistakes
Using Shader.Create instead of Shader.Find.
Using GetTexture instead of SetTexture to assign.
5fill in blank
hard

Fill all three blanks to create a material, set its color, and assign a texture.

Unity
Material mat = new Material(Shader.[1]("Standard"));
mat.[2] = new Color(1.0f, 0.0f, 0.0f);
mat.[3] = myTexture;
Drag options to blanks, or click blank then click option'
AFind
Bcolor
CmainTexture
DCreate
Attempts:
3 left
💡 Hint
Common Mistakes
Using Shader.Create instead of Shader.Find.
Trying to set color with a method instead of property.
Using SetTexture instead of mainTexture property for direct assignment.