Custom Generators & Modifiers
With TileWorldCreator you can easily create custom generators of modifiers for blueprint layers.
Simply create a new class and inherit from:
BlueprintModifierAdd the Modifier attribute to your class:
[Modifier(ModifierAttribute.Category.Generators, "My Generator", "")]Override the Execute method and add your logic there. The Execute method must return a HashSet<Vector2> with the modified/generated positions.
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
You can create a custom UI for your modifier by overriding the BuildInspector method.
You may want to hide properties by default when creating a custom UI for those. Simply add the [HideInInspector] attribute to it.
Blueprint Layer Dropdown
TileWorldCreator has a custom Blueprintlayer dropdown UI Element which can be used if you want to create a custom UI where the user can select a blueprint layer.

Last updated