Unity 2d sorting layers not working

Unity 2d sorting layers not working. DmitryKoleev, Aug 26, 2020. Feb 22, 2024 · Joined: Feb 14, 2024. 2). For complex stuff like sorting all of a character's layers but having the character act as a single "piece" with . Step 2: Click on Add Component to add a Sprite Renderer to your Empty GameObject. Sep 13, 2019 · So really it looks like what you want is Physics2D. Enable / disable the desired sorting layers. So, i can fixed my problem. Jan 24, 2013 · The solution we've got is to spawn/destroy those lights from scripts when the active scene changes. I have 2 objects, both have a Box collider 2D. Uniquely lit layers will have its own set thus increasing the amount of work needed. Thanks! Nailon_amstronic September 27, 2021, 6:41pm 2. I place ParticleSytem inside object with Sorting Group component and SortingLayer and OrderInLayer not work. I have everything rendering and showing on screen correctly in sorting layers and stuff, but the character gets the click, not the door even though the door draws on Feb 2, 2021 · Learn how to order your player sprites to be able to walk behind objects. I have attached a picture showing the current texture It wouldn't make sense to me to try and hack that into a Tilemap when it just works to have it be an object. The original and instantiated particle effects are both in the topmost layer, and the background is in the bottom layer. And just to be clear - sorting only works for transparent geometry. I've tried changing the Transparency Mode of the camera, tried every option and axis, but still won't work. 2. I had the same problem and i realised that i was only changing the parent object’s sorting layer in renderer. Note 2: 1st photo is Scene screen, 2nd photo is Game screen. The character sits in the shadow which is Just tried, and didn't work :' (. void Start () {. This makes the light go over everything, please help. Since the release of Unity 5. Oct 12, 2018 · First of all, in order to ensure the tiles get sorted by the Y-value, you need to go into Edit > Settings > Graphics, and change the Transparency Sort Mode to be Custom Axis, and change it from Z-sorted to Y-sorted by setting the values to 0,1,0 for XYZ respectively: Oct 6, 2018 · I have sorting layers setup to render everything, then a sorting layer for the screen fade renders over that, then another sorting layer called "AboveFade" that renders the "passageway" sprites. UI Canvas Renderers draw in linear transform sequence, like a stack of papers. I am still interested in a way to sort all that without using several cameras so don’t hesitate to reply later. Apr 12, 2023 · 253. I version of the code I tried with IsTouching is: Code (JavaScript): var towers = GameObject. If you're making a 2D game with a perspective camera, you might want to use TransparencySortMode. The original effects are in front of the background, both in play and edit mode. Apr 7, 2013 · For example, if the character pivot point is located at (0, 0) and an object pivot point is located at (0, 1), the character should appear in front of the object. For some reason when the shader is applied it changes layer order and goes under the items above it. I want to make a light interact with only certain layers, and I'd rather solve it in the editor than with scripting. The mask sprite is an image with dark areas representing shadow (alpha areas representing lighting). An alternative, instead of using an asset, could be to have a configuration panel somewhere to create layer groups with a name that you could select in the Target Sorting Layers property popup. Give its parent gameobject a Sorting Group. The promised code. It occupies something around 9x9. Step 3: I imported my character by dragging it into Unity Project Asset Folder. May 26, 2021 · Ryder_Developer May 26, 2021, 1:25pm 1. Hello guys, I'm creating my first 2D game and I'm having a problem related to Sorting Layers in 2D. 4. Let me know if this helped or if your problem still exists. name: Returns the name of the layer as defined in the TagManager. A lot of the time, this may not be a problem, however, there may be times when you want to display a 3D object in front of another, regardless of its distance, in order to create a specific visual effect. Same issue here. May 31, 2018 · 2. Oct 5, 2021 · 5. Instance | BindingFlags. I've placed the player's layer and the tilemap's on the same layers. However, it seems like the light rays are not rendered in the same layer Apr 9, 2019 · 2. Also, the mesh is created dynamically, and in it (MeshRenderer) i set the sorting layer. Set floors to -10, characters to 0, tall Individual Mode tilemaps to Order = 0. using UnityEngine Oct 20, 2022 · The Sorting Layers and Order in Layer values that are used to sort 2D renderers in Unity don’t work with 3D Mesh Renderers. Dec 30, 2016 · Camera: depth = 0, Middle Canvas: Sorting layer - MiddleLayer, Camera: depth = 10, Front Canvas: Sorting layer - FrontLayer, Orders in canvases are also set (for SpriteRenderers, images, ui etc. Go into your project settings and set the transparency sort mode to custom axes and put 0 / 1 / 0 (x,y,z) In generell than the sorting depends on the y position of a sprite. SpriteRenderers draw according to their Sorting Layer and Sorting Depth properties. The new parent of the pooled object had a soprting group too, which overwrited the new "dummy" sorting group of the pooled object anyway, so adding this dummy seemed to cause no sorting issues. Just noticed in one of your gifs that you have the TilemapRenderer order set. what's the problem here? unity-game-engine May 20, 2018 · Using a single tilemap and a single layer. The case is for a 2d game, top down with sprites rendering on top or under each other. Dec 10, 2009 · For Masks, create two versions of a shader. From my research, i’ve found that i need a custom shader with ZWrite Off. 3 and it still causes issues. I currently have Light2D objects being generated dynamically during level generation which works fine except I cant find a way to set the Target Sorting Layers option Jul 22, 2017 · So I'm very new to Unity and creating my first 2D game, It will have a player, monsters, platforms and a static background image. m_ApplyToSortingLayers = new int[] {. add a Foreground (and Background) "Sorting Layer" (both options only had a visual effect and did not affect the Raycast output) However, sometimes this can make one enemy prefab overlap another enemy prefab. if you are using SpriteRenderer on the quads, you can use Order in Layer property in Sprite Renderer's Inspector to make the quad appear in front of other objects. When you set the Camera component to Perspective or Orthographic, Unity automatically sets the Camera’s TransparencySortMode to match the Layers in Unity help indicate functionalities across GameObjects, such as which GameObjects should be ignored by raycasts or are invisible to the camera. Here lies my problem. The Tile script code is as follows: void OnMouseDown() { Debug. Apr 15, 2021 · Unity URP Light2D, set target sorting layers programmatically. I suspect you will. Furthermore, i changed the editor so that i Aug 9, 2019 · this is a fresh 2D project, so my cameras Projection is set to Orthograph, my BG and Object use Sprite Renderer and is use 2D collider; change the "Order in Layer", back and forth, including negative numbers. Hello Guys, I have a question, my object always shows under my background object. Nov 10, 2015 · 12,322. - Sprites have the same order in layer. Dec 22, 2021 · Unity 2D: Sorting layer changes when shader changes. Then in the Project Settings change the sorting to be based on a custom axis (the Y axis). Then prepare the character. Aug 8, 2020 · This should be solved by using the Sorting Layer of each Sprite Renderer but for whatever reason it doesn't work as intended, the camera ignores it. Therefore I have used a work around which consists in using different cameras with different depths to ensure a correct drawing order. 2f1 working in 2D, I managed to solve this problem by just adding a sorting group to the problematic pooled object. bgolus, Jan 31, 2017. #1. So What I've done is set a 2D sprite as a background image which is on the default layer. Dec 3, 2023 · However, when we disable the tile set and player renderer we can see the light is there; it is just being overwritten: We have tried the following: 1. Applied sorting layer to sprite: 3. I’m using unity 5. This is Nov 14, 2015 · Hello - I am new to Unity, and I am trying to make a 2D, top-down, isometrical game. Add a TargetSortingLayersSetter component to every light and every shadow caster in your project (I recommend to create a prefab that already includes the component). Dec 13, 2011 · organick said: ↑. I am trying to change the order of a sorting layer in unity for a 2D game but the below script isn't working for me: public GameObject player; public SpriteRenderer deadGuy; // Use this for initialization. Sep 8, 2019 · I have messed around already with the Project graphics settings to where I've changed the transparency sort mode and axis, the axis would be at 0/1/-1 now. I searched it on the Internet and I found that it's under ParticleSystemRenderer class, but it doesn't work. ) Back is for a background image and stars, middle for mountains and front for the UI. Logically setting it to Ortographic should work, but it doesn't. Okay i figured out Layermask not working properly In order to raycast to work properly, it must have some sort of distance. Nov 10, 2015 · I'm using 2D sprites in a 3D environment with Sorting Layers and the Order In Layer to decide the order of the elements relative to the camera. I am using cinemachine with pixel perfect camera for my camera and tilemaps for my background. Dec 17, 2013 · Using Unity 4. Particles always on top another visual. The texture is still being generated and changing appearances in the editor, just not being applied to the mesh correctly. 3 is now available for Unity 2022. They will behave as if the z-position is where the parent sprite is (so, the feet). Give the child SpriteRenderers (assuming your character is multiple sprites) Order setting so they render in the right order. My problem is that my character is much larger than a tile. Play and press the button and see if you get the Debug Log in the console. Nov 21, 2018 · Posts: 94. My in-editor FPS was ~80 and is now ~170. This system is useful when building complex systems or aiding in gameplay functionality like collision detection. Mar 5, 2014 · Unless I'm misunderstanding something, any colliders outside the Ground layer have to be excluded, and because of that, the only possible way to reach the Debug statement is when the collider is not tagged as "Ground" but still on the Ground layer. May 7, 2014 · MisterSkitz. The second object is on the Level0 Sorting Layer and doesn't have any scripts. The bigger the Order in Layer is, the more the quad appears in front of all the others. Layers can be batch together if they share the same set of lights. Oct 16, 2021 · Hi I'm trying to give light to specified sorting layer but it is not working. If you want to overlay a UI element, you should try using World Space canvas instead of Screen Space. 11. When you set the Camera component to Perspective or Orthographic, Unity automatically sets the Camera’s TransparencySortMode to match the Dec 15, 2023 · In short, as far as the Standard Rendering Pipeline, 1. then I set the renderer back to URP. var fieldInfo = typeof (ShadowCaster2D). When I bring up the layer collision matrix, it shows what I'm intending to do, but the collisions in-game only comply with their defaults. Graphics. When you set the Camera component to Perspective or Orthographic, Unity automatically sets the Camera’s TransparencySortMode to match the The sorting distance of a Renderer is the distance between the position of the Renderer and the Camera along the Camera’s view direction. Click to expand I'm not sure if this is 100% the problem, but changing it to the default 2d sprite helped! Sep 4, 2020 · Place several. I am using Unity 2021. I expect them to be drawn completely black since nothing is lighting them. Hope you find this useful and include it in future releases. com/c Jun 16, 2018 · I have tried some solution such like using sorting layers, setting HP bar as higher layers in sorting layer and setting the 3D house as lower layer, but it doesn't work. The weird thing is that if I place the sprites in some of my old sorting layers, and no lights are targeting Jun 19, 2019 · Same problem, sorting layers are ignored apparently. Review that all objects have Lit-Default Materials. To do this, just change the Render Mode in the (foreground) Tilemap component to Individual. 7 intensity. When I go into the Arcanist's Shop, the Arcanist NPC stays on the same sorting layer (background layer 0) as my checkered tiles, and the table is background layer 1. However my knowledge about shader is very basic. Log(Input. 0. mousePosition. Both of these lights target all sorting layers. 3. I have two scenes, my starting town, and an Arcanist's shop. GetField ("m_ApplyToSortingLayers", BindingFlags. I have a weird thing happening, that I can't quite explain. Joined: Oct 24, 2018. NonPublic); ShadowCaster2D myShadowCaster; // The reference Aug 26, 2022 · PSD Importer 7. Background - ground - ground 2 - ground Apr 3, 2013 · The texture is still being applied the same way, but instead of a normal diffuse it is now a URP/2D/Sprite-Lit-Default, and the entire texture appears black on the mesh. The only thing that solved it for me was to set the affected SpriteRenderers’ Sorting Layer to Default, and then back to their real value. 3. Hello. This is very effective when creating 2D scroller games, as you Watch this video in context on Unity's learning pages here -http://unity3d. When I Apr 22, 2016 · Since I only need to worry about this when the user click, I decided that using OnCollisionEnters2D or other function based checking is not necessary, Hence I am trying to use IsTouching or IsTouchingLayers. Oct 23, 2020 · Hi, I have a doubt, in the various "games" that I have done it happens that when two players touch the jump button it stops working. I ended up writing a companion SpriteExtendedRenderer to manage the states of a MeshRenderer to simulate the behavior of a extended SpriteRenderer, except the sorting point May 27, 2015 · 161. Jul 29, 2019 · Switching from having the 2D Lights target ~25 sorting layers, to this new configuration where they only target 3 sorting layers (background, "main layer", and foreground - we need at least a couple layers so that we can have lights target the "main layer" but not the background layer, etc) doubled my FPS. And it works! In this Unity tutorial we're going to look at how to use sorting layers, to make sure everything in a 2D game is rendered in the correct orderThis is the six To further reduce the number of Light Render Textures, it is crucial to make the Sorting Layer batchable. The gif I posted here seems to work fine when all sorting layers which need to sort with the VFX graph are set to Default. 4. In other words, I am trying to create the effect of a background/foreground according to Y position. Everything is working perfectly with one exception: Let's learn all about how 2D Sorting works with Sorting Layers and Sorting Order. When you set the Camera component to Perspective or Orthographic, Unity automatically sets the Camera’s TransparencySortMode to match the Nov 10, 2015 · Hello! My project is a 2d game. Oct 15, 2018 · When both objects are on the same Z-Axis value you shouldn’t have a problem with your sorting Layers. The other answer to sorting 3D meshes and sprites is to treat sprites like 3D objects and move both in Z so they actually are in front or behind each other in 3D space rather than rely on sorting layers and order. I have a simple script that detects the nearest interactable and highlights it by applying a shader with an outline. I am making a game, but the particle effects when instantiated are behind the background. Dec 30, 2016 · White blocks usually mean the sprite is missing or the renderer can't handle that type of material for 2D. Find “Render” in the particle component and should be the layer system there to select from. AnanasStudios, May 15, 2021. However the default package installed by 2022. Rendering the light as the last in the queque via a Render Feature. Aug 20, 2016 · Create a Script with one Public function called TestButton that just calls Debug. Step 4: Add the character into Hierarchy and then add Sprite Renderer Component to your Character. then I changed it to Custom and set to 0,1,0. I have a smooth camera transition from one room to the next when the fade is active, keeping only the passageways visible (think 2D Metroid door Feb 16, 2020 · If so, then the VFX's custom render queue should work with them. #6. The sorting distance of a Renderer is the distance between the position of the Renderer and the Camera along the Camera’s view direction. Log ("I'm pressed"). Oct 13, 2015 · I haven’t found a way to make the MeshRenderers work with the Sprites and the sorting layers. I am wondering how I can sort the layer of objects based on their position of the Y axis using a script. Hi, I have been trying to implement lighting into my 2D game and it’s not working, when I try to select witch sorting layers I want the light to cast on but none of my layers show. same sorting layer and order layer, and set transparency sort mode to costum axis y=1 z=1 but still not working Modifying the sorting layer of my mesh renderer does nothing (using the Standard shader, and I have to use this one ! (or at least a shader that have the same functions) ) Add the Sorting Group component to your Mesh Renderer and set the layers there. GetComponent< ParticleSystemRenderer >(). I'm using Custom Axis 2D with the settings at 0,1,0 as I've seen in many tutorials out there. 3 leads me to believe 7. Apr 17, 2018 · Description below. Posts: 227. Apr 8, 2018 · Masking does look like it helps the lights look like they have a lot more depth, but it won't help my dynamically created lights ability to shine on a background or foreground sorting layer. Recently I've been making a project that leans heavily on lighting. I’m trying to use sorting layer for a material so that the mesh that uses it shows on top of a sprite. value: This is the relative value that indicates the sort order of this layer relative to the other layers. I'm using 2d global light when ı make target sorting layers of the global lights none my sprites act like they are non Apr 8, 2018 · Forums > Unity Community Discussion > 2D > Forums. When you set the Camera component to Perspective or Orthographic, Unity automatically sets the Camera’s TransparencySortMode to match the Mar 13, 2019 · Hey @515Dastan - I was having the exact same issue with a set of sprites that shared Sorting Layer and were misbehaving on Android Build, while being correctly rendered on Unity Editor and UnityRemote. My issue is that the OverlapCircleAll () didn't detect the other instances of Dec 20, 2020 · This feature could be optional, you can use the asset or just set a value as usual. 3 should not cause these errors. // Update is called once per frame. Issue with Sorting Layers with an NPC and Tilemap. 1. You can sort by Y and put the pivot of objects at their base, this should get you most of the way with layer sorting. These are all the factors that can mess up sorting. plus in the bug ticket it even says verified as fixed in 7. Whatever way it works, it’s way too complicated and unintuitive. void Update () {. For the default 2D setting, this is along the (0, 0, 1) axis. Just know that your sorting layer is going to override your order in layer. I want to be able to click the door animate the door and its collider out of the way, and then be able to click on the character when he is visible. But it gets lit if I select "Default" target sorting layer in light, despite the fact that sprite has different one. setting all pivots to the bottom of the scripts helps a lot there. I also got a character from the asset store that I just pulled in to the game and set to User layer 8 (player). I have a few user created layers which work fine otherwise. Temporary workaround: Find Light2D script in packages and make "m_ApplyToSortingLayers" public: Code (CSharp): [ SerializeField] public int[] m_ApplyToSortingLayers = new int[1]; Then set it from your code: Code (CSharp): light. sortingOrder = GetSortingOrder () + 50; Normally, there isn't "sortingOrder" variable under ParticleSystem class. I set the renderer to URP then created a 2D Renderer Data asset and set its sort mode to custom and the axis to 0,1,0. com/learn/tutorials/modules/beginner/2d/sorting-layersSorting Layers and Order in Nov 10, 2015 · 12,322. 🌍 Get the Complete Builder-Defender Course! https://unitycodemonkey. Note: The blue things I censored are character. All same layer. Your answer could be improved with additional supporting information. The problem is, if we just AddComponent<Light2D>, the light only targets the default sorting layer, since the code does this: Code (csharp): [ SerializeField] int[] m_ApplyToSortingLayers = new int[1]; // These are sorting layer IDs. Any ideas appreciated, I 'upgraded' my project to use this and now basically my entire background layer is not showing up. 2 64bits, free, on windows 10. Well your sorting layers are UI derived and camera lens-Canvas overlay based whilst the order in layer is sprite based and worldly based. Unity 2019. 3 intensity and on my player I have a point light with 0. You can't even change a shadow caster's shape at runtime! But if you absolutely must, you can reflect your way to victory. Attach it to your GameObject, then attach the Button's OnClick to that Function in the editor. OverlapPoint, to get the 2D collider with the least Z value that overlaps this point in 2D. Nov 7, 2015 · To introduce the problem, the image below shows a character sprite sitting on top of a flame sprite in two sorting layers: Things became complicated when I added the 3rd sprite which is a mask sprite. The lower the number you give it, the further back the GameObject appears. Apr 15, 2016 · Sorting Order Not Working Correctly. If they aren't, try resetting it back to the Default Apr 16, 2021 · Code (CSharp): GameObject smoke = Instantiate ( SmokeReference); smoke. You can put distance = 0 and it still work but you cannot leave it blank. OverlapCircleAll () to detect any colliders before instantiating the enemy prefab which avoids the enemy prefab from overlaping an existing enemy. For the 2D Lights to have effects on the Sprites, the Sorting Layer of the Sprites needs to be the same as the Target Sorting Layer of the 2D Lights. This is called the SortingLayer . The above image shows the desired behavior and I have (mostly) achieved this result using the following: - Sprites are on the same sorting layer. one to mark the mask's presence, other to remove the mask after its done. May 15, 2021 · Everything is correct and it looks normal in scene screen but when I enter playing mode, everything mess up and shadows' places are being like horizontally flipped. The Tilemap renderer's mode is individual, according to online guides and possible solutions. FindGameObjectsWithTag("Tower"); Jun 28, 2015 · Unity 2018. When you set the Camera component to Perspective or Orthographic, Unity automatically sets the Camera’s TransparencySortMode to match the Feb 7, 2017 · Create a TargetSortingLayers asset. For example ı have 2 sorting layers inner and outer ı want to give light to inner but not to outer. This will make your objects calculate the Y position based on the individual tile's position. The higher the number, the closer the GameObject looks to the Camera. Applied target sorting layers in 2D light: Expected result: sprite is affected by light as in image below. The 2D lighting API is still woefully incomplete. I handle the tilemaps and world with sorting layers. 4f1 is 7. By default, perspective cameras sort objects based on distance from camera position to the object center; and orthographic cameras sort based on distance along the view direction. ToString()); } Jan 21, 2021 · When trying to do this however, ignore layer collision does not seem to work in real-time. Im working on a personal 2D game and have been looking into the Universal Pipeline Renderer and the Light2D object. "i can get global light to work but does not light up my Background layer (not sorting layer, actual layer) I have 2 layers, default and background and 2 cameras set up to simulate parallax by only Dec 26, 2013 · 1. Below is the method in question, it is run on Update. Jardar_Working_On_Seablip, Sep 26, 2021. Hey thanks for the question, @Mushrumforest! May I know which Unity version are you on? Sometimes it could be a Sorting Layer mismatch. Orthographic sort mode so that objects are sorted based on distance Oct 5, 2020 · Hello, I am trying to make 2D Topdown shooter. In this tutorial, you'll learn how to use the Layer Editor to create and configure Layers in your projects. However, the log shows that colliders from other layers are also being hit. sortingOrder. I also have a global light with 0. The default 3D Renderers draw stuff according to Z depth - distance from camera. . 1) Create a shader that increments the stencil buffer whenever the mask is rendered. This is the unique id assigned to the layer. 6 I had been testing the new Sorting Group component and the new Transparency Sort Mode Custom Axis. Try that. Understand how unity sprite layering, order in layer and the sprite sort points wor The sorting distance of a Renderer is the distance between the position of the Renderer and the Camera along the Camera’s view direction. theANMATOR2b and creepi like this. Posts: 2. Global Light works correctly and even the point light works correctly most of Dandan_Dev. I assume the "target sorting layers" tab is the solution, but it doesn't show any of my layers. Aug 1, 2022 · 2 Answers. If you collision with it case, just set correctly material in Inspector. I have set my Sorting Layer and Group as below for my background and objects. I searched all over the forums, and I couldn't find Aug 29, 2021 · Excuse me if the question was already asked, but I'm still fairly new to things and am a bit worried about what the best approach is to setting the sorting layer based on position as its running a few calculations in the fixed update function. Same with UI sprites in the Screen Space - Camera canvas, as long as the Canvas and its UI is also on the default sorting layer. It is not an ordered running value and it should not be used to compare with other layers to determine the sorting order. Sorting layer is tied to renderer per instance, and without the renderer nothing works with the rest of Unity. The first object is on the Level1 Sorting Layer and has a Tile script attached to it. Still seems Feb 28, 2013 · 3. Jan 28, 2020 · A lot more active on Twitter @IndieGameDAV This addresses some important setting up of unity to address unity sprite layering issues that many people have. May 15, 2021 · A custom mask shader that work with another Canvas, sorting layers, and non-UI sprite would be a perfect solution. Is this not an option, or am I missing the correct reference? All help is appreciated! Jardar. It looks like your problem never had anything at all to do with layers or layer masks, so including that in your question was a red herring. Oct 24, 2018 · Pixitales. Lo-renzo, Sep 21, 2021. 1f1 I am making a game where I hide a character behind a door. DrawMesh doesn't work with Sorting Layer. For example, if object_1 is beneath object_2, the layer for object_1 should be greater than the layer for Aug 26, 2020 · 7. İt gives everything or nothing it is 2d game. This shader discards a pixel if the mask pixel has alpha above a pre-selected cutoff (something like 0. So, I wrote a script which uses Physics2D. I went to Edit > Project Settings and changed the renderer to none so the camera settings would appear. Your have to make entries in layers and add Sorting Group to UI element. What I did for now, was create a prefab that has the light component with the layers I want to use, and then just instantiate them as required. #4. Layers that are batched together share the same set of Light Render Textures. Jan 4, 2017 · If I use a pivot-based sorting order sorting system (meaning the sprites are rendered on the same sorting layer according to a changing sorting order that depends on the y-value of its pivot point), the result is that the player is sometimes in front of the chassis when the player's pivot point is below the chassis' pivot point, and sometimes Jun 11, 2017 · I am working with 2D Light, and want to change the "Target Sorting Layers" on runtime with a script, but I can't find the correct method to do so. The sorting order decides what priority each GameObject has to the Renderer within each Sorting Layer. Hi, When I add new sorting layers and place sprites within these and no lights at all are targeting these layers the sprites end up being drawn as is. 1, which contains the fix for the inspector. Fill the property that references the asset. Edit : Typo. Jul 25, 2022 · Step 1: Go to Hierarchy -> Create Empty GameObject. What I really get: Nothing. In both situations the sorting layer is set to 0 (default). If you're doing this in code, you can access GetComponent<SpriteRenderer> (). In my case, so that the object can jump there is this in the script << Salto >> and the movement in the script << Movimiento >> To further reduce the number of Light Render Textures, it is crucial to make the Sorting Layer batchable. aa xo he hd os ao qw kz ve pe