Role.SetName

From Intrigues Wiki

Role Class - SetName Method

Overview

The SetName method in the Role class allows for changing the name of a specific role.

Syntax

public void SetName(string roleName)

Description

This method is used to update the name of a role. The roleName parameter specifies the new name to be assigned to the role.

Usage

Use this method to modify the name of a role dynamically during runtime. This can be useful for customizing roles or adapting them to different scenarios within the game.

Example of Usage

public class RoleManager : MonoBehaviour {
    void ChangeRoleName() {
        // Retrieve a specific role, e.g., "Leader"
        var role = IM.GetRole("Leader");

        // Change the name of the role
        role.SetName("Supreme Leader");
    }
}

Remarks

  • Changing the name of a role can have significant impacts on the game's logic and UI, especially if other components are dependent on the role's name.
  • It's recommended to handle the onRoleNameChanged event to update any dependent systems or interfaces when a role's name is changed.