Skip to content

Tutorial: Tag-Based Filtering

Make red objects only fit red slots, and blue objects only fit blue slots. By the end of this tutorial, mismatched objects will be silently rejected - no code required.

Prerequisites: Complete Tutorial: Your First Drag and Drop or have an equivalent scene with at least two movable objects and two slots wired through a transfer process.


1. Starting Point

You should have a working scene with:

  • At least two movable objects (e.g., RedCube and BlueCube)
  • At least two slots (e.g., RedSlot and BlueSlot)
  • Detection and transfer already wired (see the basic tutorial)

If you only have one of each from the basic tutorial, duplicate them now.


2. Create Color Tags

Tags are small label assets that you create once and reuse everywhere. They carry no logic - they are just names that the filtering system can match against.

In the Project window:

  1. Right-click in your Assets folder.
  2. Select Create > Jungle > Octoputs > Attachment Tag.
  3. Name it Red.
  4. Repeat to create a Blue tag.

Tags are identifiers, not data

AttachmentTag assets carry no data beyond their identity. Two tags are "different" if they are different ScriptableObject assets. The name is for your reference only.


3. Label Your Objects

Now tell each cube which color it is.

Select RedCube. In its AttachableObject component, find the Filtering section and add the Red tag to the Tags list.

Select BlueCube. Add the Blue tag to its Tags list.


4. Label Your Slots

Do the same for the receiving slots.

Select RedSlot. In its AttachmentPoint component, find the Filtering section and add the Red tag to the Tags list.

Select BlueSlot. Add the Blue tag.

Objects and slots can have multiple tags

A single object or slot can have many tags. A "PurpleCube" could have both Red and Blue tags, and a "UniversalSlot" could also have both.


5. Add a Filter That Enforces the Tags

Tags alone are just labels - they do not block anything yet. You need a filter that checks whether an incoming object's tags match the slot's requirements.

Select RedSlot. In its AttachmentPoint component, find the Attachable Filters list in the Filtering section. Add a new entry and select Attachable Tag Filter from the type dropdown.

Configure it:

Field Value
Required Tags Red
Requirement Any

Repeat for BlueSlot with the Blue tag.

Where to place the filter

Filters can live on the slot (filtering which objects it accepts), on the object (filtering which slots it accepts), or on the transfer process (filtering both sides during transfer). For this tutorial, placing filters on the slots is the most intuitive - each slot decides what it will accept.


6. Test the Filtering

Press Play. Try to transfer both cubes to both slots:

  • RedCube into RedSlot - succeeds. The red tag matches the filter.
  • RedCube into BlueSlot - rejected. The red tag does not satisfy the blue filter.
  • BlueCube into BlueSlot - succeeds.
  • BlueCube into RedSlot - rejected.

The transfer process silently skips ineligible combinations. No errors are thrown - the object simply stays where it is.


7. Filter Requirement Modes

The tag filter supports four matching modes that give you flexibility beyond simple one-to-one matching. Change the Requirement field to experiment:

All - "must have every tag"

Every tag in the Required Tags list must be present on the object.

Filter requires: [Red, Heavy]
Object has: [Red, Heavy, Fragile] -> PASS
Object has: [Red] -> FAIL (missing Heavy)

Any - "must have at least one"

At least one required tag must be present.

Filter requires: [Red, Blue]
Object has: [Red] -> PASS
Object has: [Green] -> FAIL

One - "must match exactly one"

Exactly one required tag must match. Useful for "pick one category" logic.

Filter requires: [Red, Blue, Green]
Object has: [Red] -> PASS
Object has: [Red, Blue] -> FAIL (two matches)

AnyExcept - "must have none of these"

The object must have none of the specified tags. This is an exclusion filter.

Filter requires: [Fragile]
Object has: [Heavy, Red] -> PASS (no Fragile)
Object has: [Fragile, Red] -> FAIL

Practical example: AnyExcept

A "Trash Bin" slot with an AnyExcept filter for [Valuable] would accept any object except those tagged as valuable.


8. Combining Multiple Filters

You can add multiple filters to the same slot. All filters must pass for an object to be accepted (AND logic).

For example, on a single slot:

  1. AttachableTagFilter - requires the Red tag
  2. AttachableHeldStateFilter - requires the object to not be currently attached elsewhere

This creates a slot that only accepts free, red-tagged objects.


Next Steps