格式
typescript
Contract.CreateNewEntity(prefab_id, entity)所属类: Contract
描述
创建游戏对象。
参数
| 参数名 | 类型 | 描述 |
|---|---|---|
| prefab_id | string | 预制体id |
| entity | Entity? | 回调函数 |
返回值
| 类型 | 描述 |
|---|---|
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);
}
}