Hair Creater V5
Hi I made this mod to make it easier to create accessories on your people
- Step 1…
HairCreaterV5 is no longer MonoBehaviour and does not require the addition of a component.
This is an extension method that can be called directly from LimbBehaviour, Transform
, or any Component.The method is automatic:
– creates a GameObject
– hooks a
SpriteRenderer – sets parent, position, scale, and rotation
– correctly adjusts the sorting layer and order
– fails safely if there is no SpriteRenderer on the limbThere are no arrays, limits, or localHair anymore.
- Step 2…
The basic signature of the method looks like this:HairCreaterV5(
Sprite sprite,
Vector2 scale,
Vector3 position,
string name = "hatV5Mod",
float rotation = 0f,
float a = 1f,
int? order = null
)Returns the GameObject of the created accessory.
- Step 3…
Usage example in AfterSpawn:var person = Instance.GetComponent<PersonBehaviour>();
// Easy to use (scale = Vector2.one, position = Vector3.zero)
person.Limbs[0].HairCreaterV5(ModAPI.LoadSprite("sprites/hat.png"));// Full version with all arguments
person.Limbs[0].HairCreaterV5( ModAPI.LoadSprite("sprites/hair.png"),
new Vector2(1.1f, 1.05f), //scale
new Vector3(-0.04f, -0.03f), // local position
"Hair", // name
2f, // rotation (in degrees)
0.9f, // alpha channel
2 // sorting order
); - Notes:
– The method can be called from LimbBehaviour, Transform, or any Component
– If there is no SpriteRenderer on the limb, the accessory is not created and the warning
– order can be omitted, then it is set automatically
– You can create as many accessories as you want on one limb
report bugs and so on in the comments under the mod, you can get the source code from
Google Drive [drive.google.com]