void Start() { aux = AuxManager.instance; shadowMaterial = aux.GetShadowMaterial(); shadowColor = aux.GetShadowColor(); transformCaster = transform; transformShadow = new GameObject().transform; transformShadow.parent = transformCaster; transformShadow.gameObject.name = "Shadow"; transformShadow.localRotation = Quaternion.identity; sRendererCaster = GetComponent <SpriteRenderer>(); sRendererShadow = transformShadow.gameObject.AddComponent <SpriteRenderer>(); sRendererShadow.sprite = sRendererCaster.sprite; sRendererShadow.material = shadowMaterial; sRendererShadow.color = shadowColor; sRendererShadow.sortingLayerName = sRendererCaster.sortingLayerName; sRendererShadow.sortingOrder = sRendererCaster.sortingOrder - 2; }