PixelGUIRendererComponent

Designates pixel values to enable the player to draw sprites on the UI as desired. We recommend using a size of less than 16x16.

# Properties

[{"index":"int32 Height (ReadOnly)","0":"The height of the sprite."}]

[{"index":"boolean IgnoreMapLayerCheck","0":"Does not perform automatic substitution when the Map Layer's name is specified in SortingLayer."}]

[{"index":"int32 OrderInLayer","0":"Determines the priority within the same Layer. A higher number indicates higher priority."}]

[{"index":"boolean OverrideSorting (ReadOnly)","0":"Determines whether to set the SortingLayer and OrderInLayer values manually."}]

[{"index":"boolean RaycastTarget","0":"This can be tapped or clicked when it's set as true. The UI hidden behind it will not respond to the input."}]

[{"index":"string SortingLayer","0":"When two or more entities overlap, the priority will be determined by the Sorting Layer."}]

[{"index":"int32 Width (ReadOnly)","0":"The width of the sprite."}]

##### 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 FillColor(Color color) (ClientOnly)","0":"Changes the color of the entire sprite."}]

[{"index":"Color GetPixel(int32 x, int32 y) (ClientOnly)","0":"Returns the pixel value for the desired location. Bottom left is (1, 1)."}]

[{"index":"table GetPixels() (ClientOnly)","0":"Returns all pixel values for the current sprite. Row comes first. (Row-major)"}]

[{"index":"table GetPixelsAsRGBAInt() (ClientOnly)","0":"Returns all pixel values as RGBA represented as integers. Prioritizes rows. (Row-major)"}]

[{"index":"void ResetWithColor(int32 width, int32 height, Color color) (ClientOnly)","0":"Resets the sprite to be customized to the size you've entered and fills it with the color."}]

[{"index":"void ResetWithColors(int32 width, int32 height, table pixels) (ClientOnly)","0":"Resets the sprite to be customized to the size you've entered and sets the values of the pixels according to the values of the tables you've entered. The number of table elements must be the same as the number of all pixels (Width*Height). Row comes first. (Row-major)"}]

[{"index":"void SetAlpha(float alpha) (ClientOnly)","0":"Changes the alpha value for the entire sprite."}]

[{"index":"void SetPixel(int32 x, int32 y, Color color) (ClientOnly)","0":"Sets the pixel value for the location you've entered. Bottom left is (1, 1)."}]

[{"index":"void SetPixels(table pixels) (ClientOnly)","0":"Sets the values of the pixels according to the values of tables you've entered. The number of table elements must be the same as the number of all pixels (Width*Height). Row comes first. (Row-major)"}]

[{"index":"void SetPixelsByRGBAInt(table pixels) (ClientOnly)","0":"Sets all pixels values as RGBA represented as integers. The length of the table must be the same as the total pixel count (Width*Height) and prioritizes rows. (Row-major)"}]

##### 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."}]

# Events

[{"index":"OrderInLayerChangedEvent","0":"This event occurs when changing the Component's OrderInLayer."}]

[{"index":"SortingLayerChangedEvent","0":"This event occurs when changing the component's SortingLayer."}]

# Examples

This is an example of how to make pixels blink randomly when you press the F key on the keyboard.
    
    
    @Component
    script PuzzleSequenceFlasher extends Component
        property table Puzzle = {}
        property any PixelGUIRendererComp = nil
        property table PuzzlePos = {}
    
        @ExecSpace("ClientOnly")
        method void OnBeginPlay()
        self.PixelGUIRendererComp = self.Entity.PixelGUIRendererComponent
        self.PixelGUIRendererComp:FillColor(Color.black)
    
        for i=1, 9 do
        	local xPos = _UtilLogic:RandomIntegerRange(1, self.PixelGUIRendererComp.Width)
        	local yPos = _UtilLogic:RandomIntegerRange(1, self.PixelGUIRendererComp.Height)
        	self.Puzzles[i] = Vector2(xPos, yPos)
        end
        end
    
        @ExecSpace("ClientOnly")
        method void StartPuzzle(number index)
        if index > #self.Puzzles then 
        	return 
        end
    
        self.PixelGUIRendererComp:SetPixel(self.Puzzles[index].x, self.Puzzles[index].y, Color.yellow)
        wait(0.35)
        self.PixelGUIRendererComp:SetPixel(self.Puzzles[index].x, self.Puzzles[index].y, Color.black)
        wait(0.1)
        self:StartPuzzle(index + 1)
        end
    
        @EventSender("Service", "InputService")
        handler HandleKeyDownEvent(KeyDownEvent event)
        --------------- Native Event Sender Info ----------------
        -- Sender: InputService
        -- Space: Client
        ---------------------------------------------------------
    
        -- Parameters
        local key = event.key
        ---------------------------------------------------------
        if key == KeyboardKey.F then
        	self:StartPuzzle(1)
        end
        end
    end
    

# SeeAlso

  * UtilLogic