Rotorz Tile System Icon
Rotorz Tile System for Unity
API Reference
Available on the Unity Asset Store
TOC

IMaterialMappings Interface

Interface that can be implemented by brushes for material mapping capabilities.
public interface IMaterialMappings
public interface IMaterialMappings

Extension Methods

RemapMaterial
Remap specified source material to the target material.

Properties

MaterialMappingFrom
Gets or sets list of materials to map from.
MaterialMappingTo
Gets or sets list of materials to map to.

Remarks

User interface for material mapping is automatically shown for brushes that implement this interface.

Examples

It is important to ensure that mapping fields are properly serialized:

using Rotorz.Tile;
using UnityEngine;

public class MyMagicBrush : Brush, IMaterialMappings {

    // Brush implementation...

    // Serialize mapping fields.
    [SerializeField]
    private Material[] _materialMappingFrom;
    [SerializeField]
    private Material[] _materialMappingTo;

    // Exposed properties for material mapping implementation.
    public Material[] MaterialMappingFrom {
        get { return _materialMappingFrom; }
        set { _materialMappingFrom = value; }
    }

    public Material[] MaterialMappingTo {
        get { return _materialMappingTo; }
        set { _materialMappingTo = value; }
    }

}
#pragma strict
import Rotorz.Tile;

class MyMagicBrush extends Brush implements IMaterialMappings {

    // Brush implementation...

    // Serialize mapping fields.
    @SerializeField
    var _materialMappingFrom:Material[];
    @SerializeField
    var _materialMappingTo:Material[];

    // Exposed properties for material mapping implementation.
    function get MaterialMappingFrom():Material[] {
        return _materialMappingFrom;
    }
    function set MaterialMappingFrom(value:Material[]) {
        _materialMappingFrom = value;
    }

    function get MaterialMappingTo():Material[] {
        return _materialMappingTo;
    }
    function set MaterialMappingTo(value:Material[]) {
        _materialMappingTo = value;
    }

}

See Also

Reference