To add a new faction, call FactionDatabase.CreateNewFaction. You can access the faction database using FactionManager.instance:
Code: Select all
FactionManager.instance.factionDatabase.CreateNewFaction(factionName, factionDescription);
Code: Select all
FactionManager.instance.AddFactionParent(factionID, parentID);
To add a new faction member, just add the component and set its faction ID:
Code: Select all
var member = myGameObject.AddComponent<FactionManager>();
member.factionID = FactionManager.instance.GetFactionID("Some Faction");
If you want to switch a faction member's faction after its Start method has run, use FactionMember.SwitchFaction:
Code: Select all
factionMember.SwitchFaction(newFactionID);
See also: Complete API Reference.