In this tutorial repostiory you'll learn how to sample a 2D texture and get a weighted randomness value based on an arbitrary color attribute. We're using grayScale value in this specific example, but any r/g/b/a or grayScale can be used.
You will understand how to read texture data at a specific pixel (or group of pixels) and map those back to the coordinate on the texture that you sampled.
In our example here, we sample a progressively larger area over time.
Have you been getting value out of these tutorials? Do you believe in LlamAcademy's mission of helping everyone make their game dev dream become a reality? Consider becoming a Patreon supporter and get your name added to this list, as well as other cool perks. Head over to https://patreon.com/llamacademy to show your support.
- Andrew Bowen
- YOUR NAME HERE!
- YOUR NAME HERE!
- Gerald Anderson
- AudemKay
- Matt Parkin
- Ivan
- Paul Berry
- Reulan
- YOUR NAME HERE!
- Bastian
- Trey Briggs
- Matt Sponholz
- Dr Bash
- Tarik
- EJ
- Chris B.
- Sean
- YOUR NAME HERE!
Interested in other AI Topics in Unity, or other tutorials on Unity in general?
- Requires Unity 2021.3 LTS or higher.