Replace player model
Overview
Resources for the tutorial can be found in the Discord channel (fag): Discord
To replace the player model, you will need to work with the following prefabs:

PlayerContext
PlayerContext is the root player prefab that:
Contains all necessary child objects and components related to player logic, graphics, and interaction.
Serves as the central entry point for player-related dependencies.
Is often used for injection into other systems (via interfaces or directly) as a unified aggregator of player logic.

In PlayerContext, it’s enough to replace the default PlayerGraphics with your own properly configured prefab. All necessary dependencies and connections will be automatically pulled into PlayerContext from the specified PlayerGraphics, provided your prefab contains the required components and interfaces.
PlayerGraphics

PlayerGraphics is the visual component responsible for displaying the player’s appearance based on their upgrade level. It contains:
The main player object (e.g., the base 3D model or root attachment point),
A set of part objects (parts, weapons, armor, etc.) for each upgrade level.
Each object in your new model must include a specific set of components and be properly configured.
Let’s review how the standard PlayerGraphics was configured:
1. Player object (Vehicle)
ExplosionEffectHandler is a component responsible for registering and managing parts involved in an explosion. This component is used separately from the PartLevelController component.
2. Wheels object
UpgradeLevelSwitcher — the component only specifies the part type.

PartLevelController is a component that manages visual objects of different upgrade levels for a single part (Part). In the inspector, a list of objects corresponding to the various levels is specified. During gameplay, when the upgrade level changes, only the object matching the current level is active; the others are deactivated (SetActive(false)).

In the context of the player model, there should be only one element per part.
PartVisualsController This component is responsible for displaying auxiliary visual effects related to parts in the gameplay interface.
Merge FX Particle effect triggered when two identical parts merge successfully (e.g., flash, sparks, smoke, etc.).
Backlight (Highlight) A visual cue for the player:
Green/bright highlight — merging is possible,
Red/dim highlight — merging is not allowed.
Used for targeting or highlighting parts on the board.
HINT: If you want a part of the object to remain unhighlighted, set the tag IgnoreMaterialBackup.
Level Indicator Displays the current level of the part (e.g., number, icon, or frame). Updates upon upgrading or merging.

ExplosionPart is a component responsible for registering and managing parts involved in an explosion. It depends on the PartLevelController component.

3. Armors object
The object contains the same set of components as the Wheels object.
4. Turrets object
The object contains the same set of components as the Wheels object, plus one additional component — Turret.
5. Ammo object
The object contains the same set of components as the Wheels object, except for ExplosionPart (since it is not visually part of the model). Additionally, it includes:
AmmoBoxPart — a component for visually representing the amount of ammunition.
SlideMover — a component that manages animated object displacement. It hides the PlayerAmmoBox object before the level starts.
6. Rockets object
The object contains the same set of components as the Wheels object. Additionally, it includes:
RocketPart — a component responsible for the visual representation of the rocket based on its upgrade level. The parameters and structure of this component must be identical:
in the player context (e.g., in PlayerContext),
in the part context (Part, path: Assets/StaticAssets/Prefabs/Parts/...).
RocketLauncher — registers components of the launched rockets.
Mandatory and recommended components for each part (Part)
Regardless of the part type, each part prefab must have the following components installed:
Mandatory:
UpgradeLevelSwitcher — handles switching the part’s upgrade level.
PartLevelController — manages the display of visual objects for different levels.
PartVisualsController — controls visual effects and part display.
Recommended / Optional:
ExplosionEffectHandler / ExplosionPart — components for visualizing part destruction effects.
Additional components:
Any custom scripts or systems needed for the specific functionality of the part.
Last updated