Description
The Targets
property of the PrefabVariable
class is a list of PrefabVariableTarget
objects. This property holds the component variables that are being targeted by the prefab variable. It is a public, non-static property, meaning it can be accessed from an instance of the PrefabVariable
class.
Usage
To use the Targets
property, you need to have an instance of the PrefabVariable
class. You can then access the Targets
property to get or set the list of PrefabVariableTarget
objects. This property is marked with the HideAttribute
, which may affect its visibility in certain contexts, such as editors or serialization.
Example
// Example of accessing the Targets property
PrefabVariable prefabVariable = new PrefabVariable();
// Accessing the Targets property
List<PrefabVariable.PrefabVariableTarget> targets = prefabVariable.Targets;
// Adding a new target
PrefabVariable.PrefabVariableTarget newTarget = new PrefabVariable.PrefabVariableTarget();
prefabVariable.Targets.Add(newTarget);
// Iterating over targets
foreach (var target in prefabVariable.Targets)
{
// Perform operations with each target
}