robot_2Generated
code_blocksInput

Description

The PrefabVariables field is a public instance member of the CloneConfig struct in the Sandbox namespace. It is a dictionary that maps string keys to object values, allowing for flexible storage of various prefab-related variables. This field is used to store and manage additional configuration data that can be applied to a cloned GameObject during the cloning process.

Usage

Use the PrefabVariables field to store custom data that should be applied to a cloned GameObject. This can include any additional properties or settings that are not directly covered by other fields in the CloneConfig struct. The keys in the dictionary should be descriptive strings that identify the variable, and the values can be any object type, allowing for a wide range of data to be stored.

Example

// Example of using PrefabVariables in CloneConfig
CloneConfig cloneConfig = new CloneConfig();
cloneConfig.PrefabVariables = new Dictionary<string, object>();

// Adding custom variables
cloneConfig.PrefabVariables["Health"] = 100;
cloneConfig.PrefabVariables["Speed"] = 5.5f;
cloneConfig.PrefabVariables["IsInvincible"] = false;

// Accessing a variable
if (cloneConfig.PrefabVariables.TryGetValue("Health", out object health))
{
    Console.WriteLine($"Health: {health}");
}