粒子效果无法直接修改position
属性进行修改
(错误的方法:
particleSystem.shape.postion = other.transform.postion
)
需要获取shape
模块进行修改
ParticleSystem.ShapeModule _editableShape = m_particleSystem.shape;
public class ParticleSystemShapeChanger: MonoBehaviour
{
private ParticleSystem m_particleSystem;
private void Start()
{
m_particleSystem = GetComponent<ParticleSystem>();
ParticleSystem.ShapeModule _editableShape = m_particleSystem.shape;
_editableShape.position = new Vector3(1f, 2f, 3f);
}
}
eg.
先将脚本挂载到对应对象上
并把对应的粒子系