Guides
Guides
These docs are for v3.1.0. Click to read the latest docs for v3.3.0.

VRTK_PolicyList

Overview

The Policy List allows to create a list of either tag names, script names or layer names that can be checked against to see if another operation is permitted.

A number of other scripts can use a Policy List to determine if an operation is permitted based on whether a game object has a tag applied, a script component on it or whether it's on a given layer.

For example, the Teleporter scripts can ignore game object targets as a teleport location if the game object contains a tag that is in the identifiers list and the policy is set to ignore.

Or the teleporter can only allow teleport to targets that contain a tag that is in the identifiers list and the policy is set to include.

Add the Policy List script to a game object (preferably the same component utilising the list) and then configure the list accordingly.

Then in the component that has a Policy List paramter (e.g. BasicTeleporter has Target List Policy) simply select the list that has been created and defined.

Inspector Parameters

  • Operation: The operation to apply on the list of identifiers.
  • Check Type: The element type on the game object to check against.

Class Variables

  • public enum OperationTypes - The operation to apply on the list of identifiers.
  • Ignore - Will ignore any game objects that contain either a tag or script component that is included in the identifiers list.
  • Include - Will only include game objects that contain either a tag or script component that is included in the identifiers list.
  • public enum CheckTypes - The types of element that can be checked against.
  • Tag - The tag applied to the game object.
  • Script - A script component added to the game object.
  • Layer - A layer applied to the game object.

Class Methods

Find/1

public virtual bool Find(GameObject obj)

  • Parameters
  • GameObject obj - The game object to check if it has a tag or script that is listed in the identifiers list.
  • Returns
  • bool - If the operation is Ignore and the game object is matched by an identifier from the list then it returns true. If the operation is Include and the game object is not matched by an identifier from the list then it returns true.

The Find method performs the set operation to determine if the given game object contains one of the identifiers on the set check type. For instance, if the Operation is Ignore and the Check Type is Tag then the Find method will attempt to see if the given game object has a tag that matches one of the identifiers.

Check/2

public static bool Check(GameObject obj, VRTK_PolicyList list)

  • Parameters
  • GameObject obj - The game object to check.
  • VRTK_PolicyList list - The policy list to use for checking.
  • Returns
  • bool - Returns true of the given game object matches the policy list or given string logic.

The Check method is used to check if a game object should be ignored based on a given string or policy list.