Modding:Adding Code to the Player: Difference between revisions

m
Clarify when this can be used.
m (Clarify when this can be used.)
Line 6: Line 6:


You can use the <code>[PlayerMutator]</code> attribute and <code>IPlayerMutator</code> interface to modify the player object before the game begins, immediately after the player <code>GameObject</code> is first created.
You can use the <code>[PlayerMutator]</code> attribute and <code>IPlayerMutator</code> interface to modify the player object before the game begins, immediately after the player <code>GameObject</code> is first created.
'''This method works only when the player starts a New Game.''' If a player loads your mod on an existing save, <code>[PlayerMutator]</code> code is never called.


This structure allows you to run custom code on the player object. For example, you might add custom parts to the player from your mod, which is otherwise very difficult to do.
This structure allows you to run custom code on the player object. For example, you might add custom parts to the player from your mod, which is otherwise very difficult to do.