Files
ppg-modkit/extracted_wiki_content/snippets/random_sprite_assignment.txt

14 lines
679 B
Plaintext

URL: https://wiki.studiominus.nl/snippets/assignTextures.html
Title: People Playground Modding - Random sprite assignment
==================================================
Random sprite assignment
This code snippet shows how to set the sprites of an object that has a random sprite. Think of items like the Handcannon, Bowlingball, and Balloon🎈.
//get the RandomSpriteBehaviour from the object (if it has one) and assign an array of your sprites to it
Instance.GetComponent<RandomSpriteBehaviour>().sprites = new Sprite[]
{
ModAPI.LoadSprite("ball_1.png"),
ModAPI.LoadSprite("ball_2.png"),
ModAPI.LoadSprite("ball_3.png"),
ModAPI.LoadSprite("ball_4.png"),
};