Skip to main content

Spline Terrain Image Swap

This script swaps the sprite used in a spline terrain to Memeorang Man's head

Put it only any spline terrain floor.

registerType("UnityEngine.U2D.SpriteShapeController")
registerType("SpriteShapeLevelBuilder")
registerType("UnityEngine.U2D.Animation.SpriteSkin") -- only whitelisted in version 3.0+
registerType("SpriteRenderer")
registerType("UnityEngine.U2D.SpriteShape")
registerType("UnityEngine.U2D.AngleRange")

local spriteShapeController = getCurrentItem().GetComponent("SpriteShapeLevelBuilder").SpriteShapeController

local newSpriteShape = UnityObject.Instantiate(spriteShapeController.spriteShape) -- recreate it so it doesnt modify the prefab and effect everyting

local memeorangMan = getItemsByMemeId("MemeorangMan")[1]

local someMemeorangManSprite = memeorangMan.GetComponentInChildren(getType("UnityEngine.U2D.Animation.SpriteSkin")).GetComponent("SpriteRenderer").sprite

newSpriteShape.angleRanges[1].sprites = {someMemeorangManSprite}

spriteShapeController.spriteShape = newSpriteShape