Perishable

This component makes your prefab decompose over time. This does not imply removing the prefab unless you set a replacement!

Component Perishable Fields

TypeNameDescription
numberperishtimehow long it takes to perish in total
functionperishfnfires when perishing (before replacement)
stringonperishreplacementIf you set this, the prefab turns into something else when perished.

Component Perishable Methods

NameParameterReturnsDescription
IsFresh,IsStale,IsSpoilednilbooleandepends on percent left
GetPercentnilnumber (percent)-
SetPercentpernil-
ReducePercentamountnilsubtracts that many percent of total perishtime from the remaining perishtime
StartPerishing, StopPerishingnilnilControl whether the prefab spoils.

Example