Policy.SetName

From Intrigues Wiki

Policy Class - SetName Method

Overview

The SetName method in the Policy class is used to change the name of a policy.

Syntax

public void SetName(string policyName)

Description

This method allows for dynamically updating the name of a policy during runtime. It is particularly useful when policies need to be renamed based on game events or player actions.

Parameters

  • policyName: A string representing the new name to be assigned to the policy.

Usage

The SetName method can be invoked on a Policy instance to update its name. This change will reflect wherever the policy's name is displayed or used in the game.

Example of Usage

public class PolicyRenamer : MonoBehaviour {
    private Policy currentPolicy;

    void Start() {
        // Fetching the 'Economy' policy from the game's policy manager
        currentPolicy = IM.GetPolicy("Economy");

        if (currentPolicy != null) {
            // Changing the policy's name to "New Economy Plan"
            currentPolicy.SetName("New Economy Plan");
        }
    }
}

Remarks

  • The new name is immediately applied to the policy and will be reflected in all instances where the policy's name is accessed or displayed.
  • This method should be used cautiously as changing policy names can impact game mechanics and player recognition, especially if the policy name is widely referenced or known.