<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://www.wlabsocks.com/wiki/index.php?action=history&amp;feed=atom&amp;title=Culture.onCultureNameChanged</id>
	<title>Culture.onCultureNameChanged - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://www.wlabsocks.com/wiki/index.php?action=history&amp;feed=atom&amp;title=Culture.onCultureNameChanged"/>
	<link rel="alternate" type="text/html" href="http://www.wlabsocks.com/wiki/index.php?title=Culture.onCultureNameChanged&amp;action=history"/>
	<updated>2026-05-13T02:24:29Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.5</generator>
	<entry>
		<id>http://www.wlabsocks.com/wiki/index.php?title=Culture.onCultureNameChanged&amp;diff=966&amp;oldid=prev</id>
		<title>Tayfunwiki: Created page with &quot;== &lt;code&gt;onCultureNameChanged&lt;/code&gt; Event in Culture Class ==  === Overview === The &lt;code&gt;onCultureNameChanged&lt;/code&gt; event in the Culture class is a mechanism that triggers when the name of a culture is changed in the game. This event is particularly useful in dynamic game environments where cultural attributes can evolve or be modified during gameplay.  === Event Definition === &lt;syntaxhighlight lang=&quot;c#&quot;&gt; public event Action&lt;string&gt; onCultureNameChanged; &lt;/syntaxhighl...&quot;</title>
		<link rel="alternate" type="text/html" href="http://www.wlabsocks.com/wiki/index.php?title=Culture.onCultureNameChanged&amp;diff=966&amp;oldid=prev"/>
		<updated>2024-01-05T03:37:41Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;== &amp;lt;code&amp;gt;onCultureNameChanged&amp;lt;/code&amp;gt; Event in Culture Class ==  === Overview === The &amp;lt;code&amp;gt;onCultureNameChanged&amp;lt;/code&amp;gt; event in the Culture class is a mechanism that triggers when the name of a culture is changed in the game. This event is particularly useful in dynamic game environments where cultural attributes can evolve or be modified during gameplay.  === Event Definition === &amp;lt;syntaxhighlight lang=&amp;quot;c#&amp;quot;&amp;gt; public event Action&amp;lt;string&amp;gt; onCultureNameChanged; &amp;lt;/syntaxhighl...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== &amp;lt;code&amp;gt;onCultureNameChanged&amp;lt;/code&amp;gt; Event in Culture Class ==&lt;br /&gt;
&lt;br /&gt;
=== Overview ===&lt;br /&gt;
The &amp;lt;code&amp;gt;onCultureNameChanged&amp;lt;/code&amp;gt; event in the Culture class is a mechanism that triggers when the name of a culture is changed in the game. This event is particularly useful in dynamic game environments where cultural attributes can evolve or be modified during gameplay.&lt;br /&gt;
&lt;br /&gt;
=== Event Definition ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c#&amp;quot;&amp;gt;&lt;br /&gt;
public event Action&amp;lt;string&amp;gt; onCultureNameChanged;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Description ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;onCultureNameChanged&amp;lt;/code&amp;gt; is an event that takes a string parameter, which typically represents the old name of the culture.&lt;br /&gt;
* The event allows for additional actions or updates to be executed in response to the change in the culture's name.&lt;br /&gt;
&lt;br /&gt;
=== Usage ===&lt;br /&gt;
This event can be used in scenarios such as:&lt;br /&gt;
&lt;br /&gt;
* Updating UI elements that display the culture's name.&lt;br /&gt;
* Logging or tracking changes in cultural attributes for gameplay analytics or narrative purposes.&lt;br /&gt;
* Triggering other game mechanics or events that are dependent on cultural information.&lt;br /&gt;
&lt;br /&gt;
=== Example of Usage ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c#&amp;quot;&amp;gt;&lt;br /&gt;
public class CultureNameChangeHandler : MonoBehaviour {&lt;br /&gt;
    void Start() {&lt;br /&gt;
        Culture playerCulture = IM.Player.Culture;&lt;br /&gt;
        if (playerCulture != null) {&lt;br /&gt;
            playerCulture.onCultureNameChanged += HandleCultureNameChange;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    private void HandleCultureNameChange(string oldName) {&lt;br /&gt;
        string newName = IM.Player.Culture.CultureName;&lt;br /&gt;
        Debug.Log($&amp;quot;Culture name changed from {oldName} to {newName}&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    void OnDestroy() {&lt;br /&gt;
        if (IM.Player.Culture != null) {&lt;br /&gt;
            IM.Player.Culture.onCultureNameChanged -= HandleCultureNameChange;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Here's how the &amp;lt;code&amp;gt;onCultureNameChanged&amp;lt;/code&amp;gt; event might be implemented in a game script:&lt;br /&gt;
&lt;br /&gt;
==== Description ====&lt;br /&gt;
&lt;br /&gt;
* This script subscribes to the &amp;lt;code&amp;gt;onCultureNameChanged&amp;lt;/code&amp;gt; event of the player's culture.&lt;br /&gt;
* When the culture's name changes, &amp;lt;code&amp;gt;HandleCultureNameChange&amp;lt;/code&amp;gt; is called, receiving the old culture name as a parameter.&lt;br /&gt;
* The new name is retrieved using &amp;lt;code&amp;gt;IM.Player.Culture.CultureName&amp;lt;/code&amp;gt;.&lt;br /&gt;
* The script also unsubscribes from the event in the &amp;lt;code&amp;gt;OnDestroy&amp;lt;/code&amp;gt; method to prevent memory leaks or unwanted behavior.&lt;br /&gt;
&lt;br /&gt;
=== Remarks ===&lt;br /&gt;
&lt;br /&gt;
* It's important to manage event subscriptions responsibly to avoid issues like memory leaks or null reference exceptions.&lt;br /&gt;
* This event serves as an effective way to ensure that all parts of the game that rely on culture information remain consistent and up-to-date.&lt;/div&gt;</summary>
		<author><name>Tayfunwiki</name></author>
	</entry>
</feed>