在Untiy 2018.2.2中加载Unity 2018.1.1项目后,完全不会触发OnParticleCollision方法。在Unity 2018.1.1中一切正常。
没有任何有关更新粒子碰撞的官方信息。
这是我的Enemy脚本的C#代码。
玩家GameObject具有一个用作武器的粒子系统,并且启用了“碰撞”模块,并已正确设置以与“敌人”层相撞。
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Enemy : MonoBehaviour
{
// Enemy health
private int health = 100;
// !!! Doesn't get triggered at all !!!
// When the player's weapon hits the Enemy
private void OnParticleCollision(GameObject other)
{
Debug.Log(other.tag);
if (other.tag == "Weapon")
{
// Reduce health
health -= 50;
if (health <= 0)
{
// Disable the Enemy that was just killed
gameObject.SetActive(false);
}
}
}
}
答案 0 :(得分:0)
我解决了。
在我的敌人预制件上的对撞机组件中检查了“触发”。由于某种原因,它在2018.1中都可以使用,并且仅在2018.2中未选中“ Is Trigger”时才可用。
万一您遇到相同的问题,只需取消选中GameObjects上的“ Is Trigger”,一切就可以正常进行。