Get entity configuration||doc135541

September 20, 2022

Format

 Entity.GetCfg(cfgName) 
  • The class to which the function belongs:Entity

Description

Get the configuration information of the entity object.


Parameters

Variable name type Description
cfgName string Configuration name


Value Returned

type Description
config configuration information


Code Samples

Find the corresponding entity in the editor, right-click to copy its ID, plus the prefix is its configuration name, such as 'myplugin/player1'

on the server sideglobal script, add the register when the entity object of this class enters the gameCallbackbroadcast tipsthe object's name

local cfg = Entity.GetCfg("myplugin/player1")
Trigger.addHandler(cfg, "ENTITY_ENTER", function(context)
    local entity = context.obj1
    World.CurWorld.SystemNotice(1, entity.name, 40)    --Broadcast object name
end)