using UnityEngine; public class CreateSpotCookie : MonoBehaviour { [ContextMenu("Create Subtle Cookie")] void CreateCookie() { int size = 256; Texture2D cookie = new Texture2D(size, size, TextureFormat.RGBA32, false); float center = size / 2f; float maxDist = size / 2f; for (int y = 0; y < size; y++) { for (int x = 0; x < size; x++) { float dist = Vector2.Distance(new Vector2(x, y), new Vector2(center, center)); float normalized = dist / maxDist; // Presque tout blanc, juste le centre légèrement réduit float alpha = 1f; // Réduit seulement le centre (hot spot) if (normalized < 0.2f) { alpha = Mathf.Lerp(0.5f, 1f, normalized / 0.2f); } // Bords doux if (normalized > 0.8f) { alpha = Mathf.Lerp(1f, 0f, (normalized - 0.8f) / 0.2f); } cookie.SetPixel(x, y, new Color(alpha, alpha, alpha, alpha)); } } cookie.Apply(); byte[] bytes = cookie.EncodeToPNG(); System.IO.File.WriteAllBytes(Application.dataPath + "/SubtleSpotCookie.png", bytes); Debug.Log("Cookie créé : Assets/SubtleSpotCookie.png"); #if UNITY_EDITOR UnityEditor.AssetDatabase.Refresh(); #endif } }