BackgroundComponent

Manages the background of the map. Solid color backgrounds, MapleStory backgrounds, and web image backgrounds are available.

# Properties

[{"index":"SyncDictionary BackgroundPieces (Sync) (MakerOnly)","0":"This is the Background Piece list for the background."}]

[{"index":"Color BottomColor (Sync) (ReadOnly)","0":"A color value at the bottom of the gradient background."}]

[{"index":"boolean FitWithAspect (Sync)","0":"If the Type is Sprite, the background image isn't cut-off and the ratio is maintained so it fits the camera frame when adjusting the size."}]

[{"index":"string MaterialId (Sync)","0":"Specifies the Id of the material to be applied to the renderer."}]

[{"index":"Color MiddleBottomColor (Sync) (ReadOnly)","0":"A color value at the bottom middle of the gradient background."}]

[{"index":"float MiddleBottomRatio (Sync) (ReadOnly)","0":"The reference position of the color at the bottom middle of the gradient background. You can set a value between 0.01 and MiddleTopRatio - 0.01."}]

[{"index":"Color MiddleTopColor (Sync) (ReadOnly)","0":"A color value at the top middle of the gradient background."}]

[{"index":"float MiddleTopRatio (Sync) (ReadOnly)","0":"The reference position of the color at the top middle of the gradient background. You can set a value between MiddleBottomRatio + 0.01 and 0.99."}]

[{"index":"float ScrollRate (Sync)","0":"You can adjust the movement speed of the background when the Type is Template."}]

[{"index":"Color SolidColor (Sync) (ReadOnly)","0":"The color value with SolidColor Type. To change the background, use the ChangeBackgroundBySolidColor function."}]

[{"index":"string SpriteRUID (Sync) (ReadOnly)","0":"The RUID if the Type is Sprite. Only SpriteRUID can be used."}]

[{"index":"string TemplateRUID (Sync) (ReadOnly)","0":"RUID with Template Type. To change the background, use the ChangeBackgroundByTemplateRUID function."}]

[{"index":"Color TopColor (Sync) (ReadOnly)","0":"A color value at the top of the gradient background."}]

[{"index":"BackgroundType Type (Sync) (ReadOnly)","0":"The type of background. The background can be changed by using the ChangeBackgroundBy() functions."}]

[{"index":"string WebUrl (Sync) (ReadOnly)","0":"The URL of the web image background when the Type is Web. To change the background, use the ChangeBackgroundByWebUrl function."}]

##### inherited from Component:

[{"index":"boolean Enable (Sync)","0":"Checks whether Component is activated or not."}]

[{"index":"boolean EnableInHierarchy (ReadOnly) (HideFromInspector)","0":"Displays whether this Component is Enable in the hierarchy. If Entity Enable is false regardless of Component Enable, returns false."}]

[{"index":"Entity Entity (ReadOnly)","0":"The Entity that owns this component."}]

# Methods

[{"index":"void ChangeBackgroundByGradient(Color top, Color middleTop, Color middleBottom, Color bottom, float middleTopRatio, float middleBottomRatio)","0":"Changes the background to gradient colors."}]

[{"index":"void ChangeBackgroundBySolidColor(Color value)","0":"Changes the background to a solid color."}]

[{"index":"void ChangeBackgroundByTemplateRUID(string value)","0":"Changes the background according to the specified Template background RUID."}]

[{"index":"void ChangeBackgroundByWebUrl(string value)","0":"Changes the background to a web image."}]

[{"index":"void ChangeMaterial(string materialId)","0":"Replaces the material to be applied to the renderer."}]

[{"index":"void SetBackgroundPieceColor(string pieceName, Color color) (ClientOnly)","0":"Sets the color by searching for the Background Piece that corresponds to pieceName."}]

[{"index":"void SetBackgroundPieceEnable(string pieceName, boolean enable) (ClientOnly)","0":"Sets activation status by searching for the Background Piece that corresponds to pieceName."}]

[{"index":"void SetBackgroundPiecePosition(string pieceName, Vector2 position) (ClientOnly)","0":"Sets location by searching for the Background Piece that corresponds to pieceName."}]

[{"index":"void SetBackgroundPieceRatio(string pieceName, Vector2 ratio) (ClientOnly)","0":"Sets the background piece ratio by searching for the Background Piece that corresponds to pieceName. This ratio determines how much the Background Piece moves when the camera moves."}]

##### inherited from Component:

[{"index":"boolean IsClient()","0":"Returns whether the current execution environment is a client or not."}]

[{"index":"boolean IsServer()","0":"Returns whether the current execution environment is a server or not."}]

# Examples

The following example shows various methods of changing the background.
    
    
    @Component
    script BackgroundChanger extends Component
        @ExecSpace("ServerOnly")
        method void ChangeBackgroundExample()
        local background = self.Entity.BackgroundComponent
        background:ChangeBackgroundByTemplateRUID("794ad8421e2543d8a6d2c70307637450")
        background:ChangeBackgroundBySolidColor(Color.white)
        background:ChangeBackgroundByWebUrl("Http://WebUrl")
        end
    end
    

# SeeAlso

  * [Set Background](/docs?postId=768)