WEBVTT 00:00:01.160 --> 00:00:03.819 The sprite renderer component displays images 00:00:03.819 --> 00:00:06.383 that have been imported as the sprite type 00:00:06.383 --> 00:00:09.412 for use in both 2D and 3D scenes. 00:00:10.112 --> 00:00:12.140 The primary property of the sprite 00:00:12.140 --> 00:00:14.140 renderer is sprite. 00:00:15.648 --> 00:00:18.390 This is a reference to the sprite to render. 00:00:20.216 --> 00:00:22.649 For more information on the sprite import type 00:00:22.649 --> 00:00:25.136 please see the information linked below. 00:00:26.820 --> 00:00:29.805 Colour is the vertex colour of the rendered sprite 00:00:29.805 --> 00:00:31.805 and can be used to tint or recolour 00:00:31.805 --> 00:00:33.266 the sprite image. 00:00:35.009 --> 00:00:37.009 Colour can also be used to fade the 00:00:37.009 --> 00:00:39.009 sprite's opacity by changing the value 00:00:39.009 --> 00:00:41.009 of the colour's alpha channel. 00:00:42.738 --> 00:00:44.738 The sprite's colour property is independent 00:00:44.738 --> 00:00:47.866 of the sprite's material, so changing the colour 00:00:47.866 --> 00:00:49.866 property on a sprite will only effect 00:00:49.866 --> 00:00:51.866 that particular game object. 00:00:53.678 --> 00:00:55.678 Material is a reference to the material 00:00:55.678 --> 00:00:57.915 used to render the sprite. 00:00:59.034 --> 00:01:01.546 By default a new sprite renderer component 00:01:01.546 --> 00:01:04.831 will have the material sprite's default assigned. 00:01:06.049 --> 00:01:08.757 When using this default material the sprite will not 00:01:08.757 --> 00:01:11.299 be effected by any lighting in the scene. 00:01:12.030 --> 00:01:14.030 The sprite renderer will simply render the 00:01:14.030 --> 00:01:16.414 original sprite at full brightness. 00:01:17.234 --> 00:01:19.798 In many cases lighting is not necessary 00:01:19.798 --> 00:01:21.798 when creating a 2D game. 00:01:22.381 --> 00:01:24.381 To use lights with a sprite renderer 00:01:24.381 --> 00:01:26.381 a material with a shader that responds 00:01:26.381 --> 00:01:28.381 to lighting must be selected. 00:01:28.922 --> 00:01:32.577 Sprites Diffuse is optimised for use with sprites, 33Diffuse 00:01:32,577 --> 00:01:35,071 but many other shaders can be used. 00:01:40.353 --> 00:01:43.025 Due to the nature of shaders, and the sprite renderer, 00:01:43.025 --> 00:01:46.203 some shaders are incompatible with the sprite renderer. 00:01:47.905 --> 00:01:50.501 Sprites use standard Unity materials, 00:01:50.501 --> 00:01:52.501 however, the sprite renderer handles 00:01:52.501 --> 00:01:55.537 materials differently than the mesh renderer. 00:01:56.465 --> 00:01:58.465 The main difference is that the material's 00:01:58.465 --> 00:02:00.465 texture property is not needed. 00:02:01.393 --> 00:02:03.780 The sprite renderer will use the shader, 00:02:03.780 --> 00:02:07.078 colour and other properties from a compatible material 00:02:07.078 --> 00:02:09.078 but not the texture property. 00:02:11.028 --> 00:02:14.396 When using a material that has a sprite shader 00:02:15.117 --> 00:02:17.766 the texture property is unavailable. 00:02:20.462 --> 00:02:22.930 If the attached material has a tint colour 00:02:22.930 --> 00:02:25.807 it will be combined with the sprite's colour property. 00:02:33.102 --> 00:02:37.206 It is important to note that lighting and shadow. 00:02:37.206 --> 00:02:40.169 So when using lights and more complex shaders 00:02:40.169 --> 00:02:44.053 it is best to balance the lighting with the performance of the scene. 00:02:44.912 --> 00:02:47.617 For more information on materials and shaders, 00:02:47.617 --> 00:02:50.107 please see the information linked below. 00:02:52.783 --> 00:02:54.783 Sorting Layer and Order In Layer are 00:02:54.783 --> 00:02:56.783 the systems used to define the order 00:02:56.783 --> 00:02:58.783 in which sprites are drawn. 00:03:00.443 --> 00:03:02.568 All sprite renderers are placed on a default 00:03:02.568 --> 00:03:04.568 sorting layer when they are created. 00:03:05.800 --> 00:03:08.171 Sprites are rendered by the sprite render 00:03:08.171 --> 00:03:10.171 in the following order of priority. 00:03:11.127 --> 00:03:14.391 The order of the sorting layer, containing the sprite, 00:03:16.106 --> 00:03:18.106 the order in layer value for the sprite 00:03:18.106 --> 00:03:20.106 within that sorting layer 00:03:22.277 --> 00:03:24.277 and finally the sprite's transform position 00:03:24.277 --> 00:03:26.875 Z compared to the other sprites being rendered 00:03:26.875 --> 00:03:28.875 and the camera rendering them. 00:03:29.776 --> 00:03:32.549 In the case of sorting layers and order-in-layer 00:03:32.549 --> 00:03:34.549 items with lower values will be 00:03:34.549 --> 00:03:36.731 behind those with higher values. 00:03:37.477 --> 00:03:40.499 For more information on layers, including sorting layers, 00:03:40.499 --> 00:03:42.943 please see the information linked below.