K
K
Kot Kotov2020-02-20 16:03:23
C++ / C#
Kot Kotov, 2020-02-20 16:03:23

How to fix the error in if( Operator '!' cannot be applied to operand of type 'method group') conditions?

if(isDed == false)
      {
        pS.Play();
        isDed=true;
      }
      if(!pS.Play)
      {
        Destroy(gameObject);
      }

PS is Partial System

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Gaydak, 2020-02-20
@kot123123

if(!pS.Play)
in this line is most likely wrong.
Play( ) is a method on the pS object.
You need the type bool in the condition, which means that you need to take either a variable from the pS object (for example, isPlaying) or call a method that returns bool.
I'll add a link to see what fields and methods are
https://docs.unity3d.com/ScriptReference/ParticleS...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question