Home
  • Manual
  • Node Index
  • API
  • Changelog
Show / Hide Table of Contents
  • Tutorials
    • Creating your first map generator
      • 1. Creating your first map graph
      • 2. Running a graph at runtime
      • 3. Adding more nodes
      • 4. Object placement
    • Basic map types
      • • Cave-like maps
      • • Room-based maps
      • • Sample-based maps
      • • Combining map types
    • More Tutorials
      • • Using prefabs instead of tilemaps
      • • Changing tile/prefab/tilemap set probabilities (weighted random)
      • • Linking a named color set to tilesets/prefab sets
      • • Organizing nodes into groups
      • • Adding notes & comments
      • • Running a graph within a graph (Sub graphs)
      • • Tilemap Sets
      • • Optimization tips
      • • Static seed (daily challenges)
      • • Running a graph asynchronously/multi-threaded
      • • Object pooling
      • • Tips for rule tiles
      • • Saving and loading maps
    • Tutorials for coders
      • • Running graphs from scripts
      • • Output parameters
      • • Creating your own nodes
      • • Creating your own node views
      • • Adding a constant node type
  • Sample Project
  • Troubleshooting
  • Support

Changing tile/prefab/tilemap set probabilities (weighted random)

If you want to change the probability of a tile/prefab/tilemap entry being chosen, you can set different weights for each type entry in a set.

For example, here's a tileset with 3 different tiles, each with a different weight: Example

Increasing the weight will increase the likelihood of the entry being used. So in this example, the Grass 1 tile is most likely to be used whenever a Ground tile is requested, followed by Grass 2 and Dirt 2.

In order to use the weights, you need select the set in the project window and explicitly enable it for each type, as needed, by ticking the "Weights" checkbox. This enables the weight fields.

This is not enabled by default, because it's a bit more expensive to calculate, slightly impacting performance.

In This Article
Back to top Generated by DocFX