> For the complete documentation index, see [llms.txt](https://docs.greenhellmodding.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.greenhellmodding.com/client-code-examples/modifying-private-variables.md).

# Modifying private variables

Modifying private variables is clearly necessary when modding raft. Let's see how easy it is!

To modify private variables we need to use **Harmony**. You can visit the Harmony wiki by clicking [here](https://github.com/pardeike/Harmony/wiki).\
\&#xNAN;*`Harmony is a library for patching, replacing and decorating .NET and Mono methods during runtime.`*\
\
To use harmony you simply need to add the `Harmony` namespace by adding `using Harmony;` at the top of your class.

\
To modify a **non-static private variable** you use Traverse.Create() with the object instance, .Field() with the field name and .SetValue()

```csharp
Traverse.Create(ScriptInstance).Field("fieldname").SetValue(newvalue);

// For example to set the value "m_MinFallingHeight" of the class Player we can do that :
Traverse.Create(Player.Get()).Field("m_MinFallingHeight").SetValue(10);
```

\
To modify a **static private variable** you also use Traverse.Create() but with the class type, .Field() with the field name and also .SetValue();

```csharp
Traverse.Create(typeof(classname)).Field("fieldname").SetValue(newvalue);

// For example to set the value "s_Initialized" of the class ItemIDHelpers we can do that :
Traverse.Create(typeof(ItemIDHelpers)).Field("s_Initialized").SetValue(false);
```
