Skip to content

格式

typescript
Contract.CreateNewEntity(prefab_id, entity)

所属类: Contract

描述

创建游戏对象。

参数

参数名类型描述
prefab_idstring预制体id
entityEntity?回调函数

返回值

类型描述
void

代码示例

typescript
class TestRequest extends Contract{
    Exescute(prefab_id: string,user_id: string): void {

        this.CreateNewEntity(prefab_id,user_id,(entity:NetEntity)=>{
            this.Send(TestRequest, entity.entityID);
        });
    }

    Receive(entity_id: string): void {
        let entity = this.FindEntity(entity_id);
        Debug.Log("entity_id :: ",entity_id,"found :: ",entity != null);
    }
}