<Increment On Destroy> Problem..

Announcements, support questions, and discussion for the Dialogue System.
wlchfl5359
Posts: 29
Joined: Sat Jan 02, 2021 4:27 pm

<Increment On Destroy> Problem..

Post by wlchfl5359 »

Hi, i started use Dialogue System and i used <Increment On Destroy> on the Monster gameobject.
i set Increment On = Disable and my code runs
gameObject.SetActive(false) after animation finishes.

but they shows error -> Assertion Failed on expression: 'go.IsActive()'.

i saw GameObject.Find(specifier); is problem in FindSpecifier Method.

how can i fix it??
i want to use Disable not Destroy.

Thank you :)
User avatar
Tony Li
Posts: 22051
Joined: Thu Jul 18, 2013 1:27 pm

Re: <Increment On Destroy> Problem..

Post by Tony Li »

Hi,

Is your code throwing that error, or is the IncrementOnDestroy script?

Can you click on the error in the Console window, press Ctrl+C (Cmd+C on Mac) to copy it to the clipboard, then paste it into a reply? Since it's an assertion, it may not contain enough information to pinpoint the issue. But it will be helpful to know either way.

At what point does the error occur? What is going on in the scene at the time?
wlchfl5359
Posts: 29
Joined: Sat Jan 02, 2021 4:27 pm

Re: <Increment On Destroy> Problem..

Post by wlchfl5359 »

Assertion failed on expression: 'go.IsActive()'
UnityEngine.GameObject:Find(String)
PixelCrushers.DialogueSystem.SequencerTools:FindSpecifier(String, Boolean) (at Assets/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/SequencerTools.cs:102)
PixelCrushers.DialogueSystem.SequencerTools:GetSubject(String, Transform, Transform, Transform) (at Assets/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/SequencerTools.cs:50)
PixelCrushers.DialogueSystem.SequencerCommands.SequencerCommand:GetSubject(String, Transform) (at Assets/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Commands/SequencerCommand.cs:144)
PixelCrushers.DialogueSystem.SequencerCommands.SequencerCommand:GetSubject(Int32, Transform) (at Assets/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Commands/SequencerCommand.cs:163)
PixelCrushers.DialogueSystem.SequencerCommands.SequencerCommandNPCState:Awake() (at Assets/Scripts/SequencerCommand/SequencerCommandNPCState.cs:17)
UnityEngine.GameObject:AddComponent(Type)
PixelCrushers.DialogueSystem.Sequencer:ActivateCommand(String, String, Transform, Transform, String[]) (at Assets/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Sequencer.cs:733)
PixelCrushers.DialogueSystem.Sequencer:PlayCommand(QueuedSequencerCommand, String, Boolean, Single, String, String, String[]) (at Assets/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Sequencer.cs:682)
PixelCrushers.DialogueSystem.Sequencer:PlayCommand(QueuedSequencerCommand) (at Assets/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Sequencer.cs:651)
PixelCrushers.DialogueSystem.Sequencer:PlaySequence(String) (at Assets/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Sequencer.cs:585)
PixelCrushers.DialogueSystem.Sequencer:PlaySequence(String, Boolean, Boolean) (at Assets/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Sequencer.cs:595)
PixelCrushers.DialogueSystem.Sequencer:PlaySequence(String, Transform, Transform, Boolean, Boolean) (at Assets/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Sequencer.cs:601)
PixelCrushers.DialogueSystem.DialogueSystemController:PlaySequence(String, Transform, Transform, Boolean, Boolean, String) (at Assets/Pixel Crushers/Dialogue System/Scripts/Manager/DialogueSystemController.cs:1558)
PixelCrushers.DialogueSystem.DialogueSystemController:PlaySequence(String, Transform, Transform, Boolean) (at Assets/Pixel Crushers/Dialogue System/Scripts/Manager/DialogueSystemController.cs:1611)
PixelCrushers.DialogueSystem.DialogueSystemController:PlaySequence(String, Transform, Transform) (at Assets/Pixel Crushers/Dialogue System/Scripts/Manager/DialogueSystemController.cs:1632)
PixelCrushers.DialogueSystem.DialogueManager:PlaySequence(String, Transform, Transform) (at Assets/Pixel Crushers/Dialogue System/Scripts/Manager/DialogueManager.cs:765)
PixelCrushers.DialogueSystem.DialogueSystemTrigger:DoSequenceAction(Transform) (at Assets/Pixel Crushers/Dialogue System/Scripts/Triggers/Triggers/DialogueSystemTrigger.cs:671)
PixelCrushers.DialogueSystem.DialogueSystemTrigger:Fire(Transform) (at Assets/Pixel Crushers/Dialogue System/Scripts/Triggers/Triggers/DialogueSystemTrigger.cs:631)
PixelCrushers.DialogueSystem.DialogueSystemTrigger:TryStart(Transform, Transform) (at Assets/Pixel Crushers/Dialogue System/Scripts/Triggers/Triggers/DialogueSystemTrigger.cs:617)
PixelCrushers.DialogueSystem.DialogueSystemTrigger:TryStart(Transform) (at Assets/Pixel Crushers/Dialogue System/Scripts/Triggers/Triggers/DialogueSystemTrigger.cs:603)
PixelCrushers.DialogueSystem.DialogueSystemTrigger:OnUse() (at Assets/Pixel Crushers/Dialogue System/Scripts/Triggers/Triggers/DialogueSystemTrigger.cs:494)
UnityEngine.Events.UnityEvent:Invoke()
PixelCrushers.DialogueSystem.IncrementOnDestroy:TryIncrement() (at Assets/Pixel Crushers/Dialogue System/Scripts/Quests/IncrementOnDestroy.cs:135)
PixelCrushers.DialogueSystem.IncrementOnDestroy:OnDisable() (at Assets/Pixel Crushers/Dialogue System/Scripts/Quests/IncrementOnDestroy.cs:111)
UnityEngine.GameObject:SetActive(Boolean)
<DeadMonster>d__35:MoveNext() (at Assets/Scripts/Monster/EnemyController.cs:296)
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)


i just copied this.
and my code is


private IEnumerator DeadMonster()
{
animator.SetTrigger("Die");

while (true)
{
if (animator.GetCurrentAnimatorStateInfo(0).IsName("Die"))
{
if(animator.GetCurrentAnimatorStateInfo(0).normalizedTime >= 1)
{
float t = maxEdge;

itemDrop.DropItem(transform); //아이템 드랍

while (t >= minEdge)
{
renderer.material.SetFloat("_edge", t);
t -= 0.02f;
yield return new WaitForFixedUpdate();
}
gameObject.SetActive(false); <------- This is point where error start. after monster die, i make it setactive(false), but game doesn't stop and it happens nothing. i don't know what is reason..
yield break;
}
}
yield return null;
}

}
User avatar
Tony Li
Posts: 22051
Joined: Thu Jul 18, 2013 1:27 pm

Re: <Increment On Destroy> Problem..

Post by Tony Li »

You have configured the Increment On Destroy component's OnIncrement() event to call a Dialogue System Trigger's OnUse() method.

Make sure this Dialogue System Trigger is not on the GameObject that is being destroyed or deactivated. See DemoScene2 for an example. In DemoScene2, the Enemy GameObjects have Increment On Destroy components. The OnIncrement() events call a Dialogue System Trigger on a different GameObject, the parent GameObject named Enemies.
wlchfl5359
Posts: 29
Joined: Sat Jan 02, 2021 4:27 pm

Re: <Increment On Destroy> Problem..

Post by wlchfl5359 »

Thank you for fast reply.
I just made parent gameObject and put DialogueSystemTrigger in this object and this parent object has only trigger and do nothing.
i removed trigger on enemy object. but it happens still.
my enemy object doesn't have trigger and when it dies and setactive(false), it shows same error :(


Assertion failed on expression: 'go.IsActive()'
UnityEngine.GameObject:Find(String)
PixelCrushers.DialogueSystem.SequencerTools:FindSpecifier(String, Boolean) (at Assets/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/SequencerTools.cs:102)
PixelCrushers.DialogueSystem.SequencerTools:GetSubject(String, Transform, Transform, Transform) (at Assets/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/SequencerTools.cs:50)
PixelCrushers.DialogueSystem.SequencerCommands.SequencerCommand:GetSubject(String, Transform) (at Assets/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Commands/SequencerCommand.cs:144)
PixelCrushers.DialogueSystem.SequencerCommands.SequencerCommand:GetSubject(Int32, Transform) (at Assets/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Commands/SequencerCommand.cs:163)
PixelCrushers.DialogueSystem.SequencerCommands.SequencerCommandNPCState:Awake() (at Assets/Scripts/SequencerCommand/SequencerCommandNPCState.cs:17)
UnityEngine.GameObject:AddComponent(Type)
PixelCrushers.DialogueSystem.Sequencer:ActivateCommand(String, String, Transform, Transform, String[]) (at Assets/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Sequencer.cs:733)
PixelCrushers.DialogueSystem.Sequencer:PlayCommand(QueuedSequencerCommand, String, Boolean, Single, String, String, String[]) (at Assets/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Sequencer.cs:682)
PixelCrushers.DialogueSystem.Sequencer:PlayCommand(QueuedSequencerCommand) (at Assets/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Sequencer.cs:651)
PixelCrushers.DialogueSystem.Sequencer:PlaySequence(String) (at Assets/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Sequencer.cs:585)
PixelCrushers.DialogueSystem.Sequencer:PlaySequence(String, Boolean, Boolean) (at Assets/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Sequencer.cs:595)
PixelCrushers.DialogueSystem.Sequencer:PlaySequence(String, Transform, Transform, Boolean, Boolean) (at Assets/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Sequencer.cs:601)
PixelCrushers.DialogueSystem.DialogueSystemController:PlaySequence(String, Transform, Transform, Boolean, Boolean, String) (at Assets/Pixel Crushers/Dialogue System/Scripts/Manager/DialogueSystemController.cs:1558)
PixelCrushers.DialogueSystem.DialogueSystemController:PlaySequence(String, Transform, Transform, Boolean) (at Assets/Pixel Crushers/Dialogue System/Scripts/Manager/DialogueSystemController.cs:1611)
PixelCrushers.DialogueSystem.DialogueSystemController:PlaySequence(String, Transform, Transform) (at Assets/Pixel Crushers/Dialogue System/Scripts/Manager/DialogueSystemController.cs:1632)
PixelCrushers.DialogueSystem.DialogueManager:PlaySequence(String, Transform, Transform) (at Assets/Pixel Crushers/Dialogue System/Scripts/Manager/DialogueManager.cs:765)
PixelCrushers.DialogueSystem.DialogueSystemTrigger:DoSequenceAction(Transform) (at Assets/Pixel Crushers/Dialogue System/Scripts/Triggers/Triggers/DialogueSystemTrigger.cs:671)
PixelCrushers.DialogueSystem.DialogueSystemTrigger:Fire(Transform) (at Assets/Pixel Crushers/Dialogue System/Scripts/Triggers/Triggers/DialogueSystemTrigger.cs:631)
PixelCrushers.DialogueSystem.DialogueSystemTrigger:TryStart(Transform, Transform) (at Assets/Pixel Crushers/Dialogue System/Scripts/Triggers/Triggers/DialogueSystemTrigger.cs:617)
PixelCrushers.DialogueSystem.DialogueSystemTrigger:TryStart(Transform) (at Assets/Pixel Crushers/Dialogue System/Scripts/Triggers/Triggers/DialogueSystemTrigger.cs:603)
PixelCrushers.DialogueSystem.DialogueSystemTrigger:OnUse() (at Assets/Pixel Crushers/Dialogue System/Scripts/Triggers/Triggers/DialogueSystemTrigger.cs:494)
UnityEngine.Events.UnityEvent:Invoke()
PixelCrushers.DialogueSystem.IncrementOnDestroy:TryIncrement() (at Assets/Pixel Crushers/Dialogue System/Scripts/Quests/IncrementOnDestroy.cs:135)
PixelCrushers.DialogueSystem.IncrementOnDestroy:OnDisable() (at Assets/Pixel Crushers/Dialogue System/Scripts/Quests/IncrementOnDestroy.cs:111)
UnityEngine.GameObject:SetActive(Boolean)
<DeadMonster>d__35:MoveNext() (at Assets/Scripts/Monster/EnemyController.cs:296)
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
User avatar
Tony Li
Posts: 22051
Joined: Thu Jul 18, 2013 1:27 pm

Re: <Increment On Destroy> Problem..

Post by Tony Li »

Hi,

Would you please post screenshots of the Inspector views of both GameObjects?

I'm finishing work for the night, but I'll check back in the morning.
wlchfl5359
Posts: 29
Joined: Sat Jan 02, 2021 4:27 pm

Re: <Increment On Destroy> Problem..

Post by wlchfl5359 »

Image

this is Monster Object Inspector.

Image

this is Parent GameObject.

Thank you.
User avatar
Tony Li
Posts: 22051
Joined: Thu Jul 18, 2013 1:27 pm

Re: <Increment On Destroy> Problem..

Post by Tony Li »

Hi,

It looks like the Increment On Destroy screenshot is cut off. What does the Increment On Destroy component's OnIncrement() event invoke?

What is Wayne?

You said when the monster dies it sets itself inactive. This will cause its Increment On Destroy component to take effect. If the Increment On Destroy component's OnIncrement() event tries to do something on the monster, it may cause this error because the monster has been deactivated.

If possible, can you send a reproduction project to tony (at) pixelcrushers.com along with steps to reproduce the issue?
wlchfl5359
Posts: 29
Joined: Sat Jan 02, 2021 4:27 pm

Re: <Increment On Destroy> Problem..

Post by wlchfl5359 »

oh, sorry, there is nothing special.
Image
it sends OnUse message to Parent Object.
Parent GameObject Name is <Monsters1>

i should better find some code in monsters..
thank you.
User avatar
Tony Li
Posts: 22051
Joined: Thu Jul 18, 2013 1:27 pm

Re: <Increment On Destroy> Problem..

Post by Tony Li »

The error occurs in the NPCState(Wayne) sequencer command, which is a custom sequencer command. What is the GameObject Wayne? Is it inactive?

Also, try setting the the Monsters1 GameObject to the Play Sequence action's Sequence Speaker field.
Post Reply