예제 #1
0
        async Task <GameObject> LoadPlayerGameObject(PlayerConfig config, Transform transform)
        {
            var pallete = config.Selection.GetPallete();
            var prefab  = await pallete.Prefab.LoadAssetAsync <GameObject>().Task;

            var player = GameObject.Instantiate(prefab, transform.position, Quaternion.identity);

#if UNITY_EDITOR
            player.name = $"Player {config.PlayerID + 1} ({prefab.name})";
#endif
            var playerComponent = ObjectUtil.GetOrAddComponent <Player>(player);
            playerComponent.PlayerID = config.PlayerID;
            return(player);
        }