Custom Generators & Modifiers
BlueprintModifier [Modifier(ModifierAttribute.Category.Generators, "My Generator", "")]HashSet<Vector2> Execute(HashSet<Vector2> _positions, BlueprintLayer _layer)Example
[Modifier(ModifierAttribute.Category.Generators, "Random Noise", "")]
public class RandomNoise : BlueprintModifier
{
public float weight = 0.5f;
public int rndSeed;
private int width;
private int height;
public override HashSet<Vector2> Execute(HashSet<Vector2> _positions, BlueprintLayer _layer)
{
// Get the map width and height
width = asset.width;
height = asset.height;
for (int x = 0; x < width; x ++)
{
for (int y = 0; y < height; y ++)
{
// Use the layers random struct.
float sample = Mathf.PerlinNoise((float)x / (float)width + _layer.random.NextFloat(0, 100), (float)y / (float)height + _layer.random.NextFloat(0, 100));
if (sample > weight)
{
_positions.Add(new Vector2(x, y));
}
}
}
return _positions;
}
}Create custom UI
Blueprint Layer Dropdown

Last updated