/// <summary>
/// Enable this model group; enable on default model, links up models to nodes, upwards-recurse enable children groups
/// </summary>
internal void enableGroup()
{
if (enabled)
{
return;
}
enabled = true;
modelRoot = new GameObject("Root-" + name);
if (parent == null)
{
MonoBehaviour.print("ERROR: Attempt to enable a group at runtime with no parent defined. This should never happen. Bad things are likely to occur soon.");
//TODO -- yah.. this should be unpossible
}
else
{
ModelSwitchData model = modelData.Find(m => m.enabled == true);//for cases where data was loaded from persistence
if (model == null)
{
model = enableDefaultModel();//otherwise just enable the default from the config
}
ModelNode node = parent.findNode(parentNode);
if (node == null)
{
MonoBehaviour.print("ERROR: Node was null for name: " + parentNode + " for group: " + name);
}
modelRoot.transform.NestToParent(node.transform);
setupNodesForModel(model);
initializeModels();
}
}