我是靠谱客的博主 震动斑马,这篇文章主要介绍Trying to Invoke method: CallZombies.Spawn couldn’t be called,现在分享给大家,希望可以做个参考。
解决办法:看看自己方法名写对了没 怎么写成了Spwan???
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49void PrepareSpawn() { // 检测个数,是否继续生成 if(spawnPoint.childCount >= maxChildNum) { return; } // 血量太低停止召唤,召唤一个需要消耗1%血量 if (enemyHealth.currentHealth > enemyHealth.startingHealth * 0.1f) { enemyHealth.currentHealth -= (int)(0.01f * enemyHealth.startingHealth); } else { return; } // 播放技能动画 Animator anim = GetComponent<Animator>(); anim.SetTrigger("ShowSkill"); Invoke("Spawn", 1f); } void Spwan() { // 音效 audioSource.clip = callZombiesAudio; audioSource.Play(); // 设置物品编号 zombiesIndex = Random.Range(0, zombiePrefab.Length); // 设置真实刷新位置 Vector3 realSpawnPoint; float shiftingX = Random.Range(-maxShiftingValue, +maxShiftingValue); // 刷新位置X轴随机偏移值 float shiftingZ = Random.Range(-maxShiftingValue, +maxShiftingValue); // 刷新位置Z轴随机偏移值 realSpawnPoint.x = transform.position.x + shiftingX; realSpawnPoint.z = transform.position.z + shiftingZ; realSpawnPoint.y = transform.position.y; // 设置刷新点方向 Quaternion spawnRotation = transform.rotation; // 当前BOSS的旋转角度 //Quaternion spawnRotation = Quaternion.identity; // 默认(0,0,0)旋转角度 // 在刷新点上刷新物品 GameObject go = (GameObject)Instantiate(zombiePrefab[zombiesIndex], realSpawnPoint, spawnRotation); // 设置父子关系,把物品放在刷新点下 go.transform.SetParent(spawnPoint); //print(go.name + ":已刷新"); //test }
最后
以上就是震动斑马最近收集整理的关于Trying to Invoke method: CallZombies.Spawn couldn’t be called的全部内容,更多相关Trying内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复