How to do these couple of things?



  • Ahh ok. I tried adding 'IsOnSWSMovement' as a bool and I can see why you recommended the workaround instead. The bool had to be added in all the coroutines and not just in navMove.StartMove(). Because somewhere down the line the bool returned false and I didn't stop it. I do see some Stop() in various places so probably that's what affects it.

    If I disable the navMove component, what happens to all running coroutines? Do they all auto get stopped and removed from memory?



  • So on navMove.Reverse(), it seems to reverse the whole path?

    No one ever worked with Reverse on navMove, I guess :) I reworked parts of the script and removed the Array.Reverse thing. You can now check the 'Reverse' bool reliably to find out whether the object is moving in the other direction. The 'repeat' bool does not exist anymore.

    Waiting for Asset Store to update takes very long..

    I sneaked the fix into the same live version (5.4.7). It should go live within the next few hours - if you see today's upload date on the Asset Store page, you will know it's the updated version.

    Finally setting this to solved, please search or create new threads if you experiencing any issues :)



  • Yes, a coroutine needs a component to run on. Disabling the component throws all coroutines on the MonoBehavior away. Therefore for Stop() it will work (since Stop() cancels the coroutine anyway), but not for Pause() (as it cannot continue later).

    Edit: I have just found a somewhat old post which states mixed outcomes when disabling a component:
    https://answers.unity.com/questions/34169/does-deactivating-a-gameobject-automatically-stop.html

    I still think the above is valid, although you could try it out, if disabling (the component, not gameobject) also works with navMove.Pause(). Unfortunately I can't test myself as I am on vacation and will return to the office next week.



  • Ok, I understand. No worries man, stay safe and enjoy your vacation!
    Btw, over at Node Canvas site, I see integration for SWS. Am I right to say the integration is done by your team?

    Edit: Don't forget to wear a mask! (Just a reminder from one human to another)



  • Back in the office, thank you for caring ;)
    The face mask signs in Italy are everywhere, though some try to ignore them anyway.

    Btw, over at Node Canvas site, I see integration for SWS. Am I right to say the integration is done by your team?

    The guy(s) from Node Canvas made that integration, I haven't seen it since I do not own a copy of Node Canvas.

    Just tested the above coroutine scenario and found that:

    • regardless of enabling/disabling the script, coroutines and movement still stay active
    • which means that they are not destroyed when disabling the component, only deactivating the whole game object destroys them

    Because of that, I added "IsMoving" and "IsPaused" methods to splineMove/navMove, which you can check to find out whether waypoint patrolling is currently active or not. (Technical note) First I tried to do it with another internal Coroutine variable, but Unity just wouldn't let it work, so I had to do it with a bool variable. The update should go live within the next 24 hours.



  • Don't mention it :)
    Yea I know. I watch Trevor Noah show and I seriously can't believe how some people just ignore them and party..

    Ok noted. Anyway, just yesterday I decided to drop Node Canvas and do everything in a script. My brain simply can't wrap around the idea of using a behaviour tree and the different flavour of nodes just makes thing way more confusing.

    Ahh ok, I understand now and thanks for updating. But I already implemented my own bool which I mentioned above and also added other methods like finding a closest waypoint and waypoint index from its transform. So I might take some time to update it by comparing and replacing appropriate codes.

    Side question: I understand this thread is for support for SWS but can I also ask you game logic questions related to navmesh, not directly but indirectly related to SWS as it's part of my AI movement logic. I know I can ask in Unity forums but you have a solid experience in these subject and something that I might take 1-2 days of searching could probably be answered in a couple of minutes by you. But if you are not ok I can stick to Unity forums :) No worries!



  • Ahh ok, I understand now and thanks for updating. But I already implemented my own bool which I mentioned above and also added other methods like finding a closest waypoint and waypoint index from its transform. So I might take some time to update it by comparing and replacing appropriate codes.

    Ah, great. If your "find waypoint and waypoint index" is a separate method, you could just copy-paste them again. Since it basically does the same, it's your choice of course.

    Side question: I understand this thread is for support for SWS but can I also ask you game logic questions related to navmesh

    How about you ask on the Unity forums and leave a link here, so I can still pay a visit to it there, but close this thread. :)



  • @Baroni said in How to do these couple of things?:

    Ah, great. If your "find waypoint and waypoint index" is a separate method, you could just copy-paste them again. Since it basically does the same, it's your choice of course.

    Ok, I'm doing that now! BTW, on Ping Pong movement when it is going backwards (currentPoint--) is there any way to check if AI is currently on reverse? The 'reverse' bool does not seem to work.

    Edit: I made 'repeat' public.

    How about you ask on the Unity forums and leave a link here, so I can still pay a visit to it there, but close this thread. :)

    No worries man! I can handle this :)



  • BTW, on Ping Pong movement when it is going backwards (currentPoint--) is there any way to check if AI is currently on reverse? The 'reverse' bool does not seem to work.

    Ugh, just checked the example scenes. You're right, works as expected with splineMove but not with navMove. Tracking this as a bug report!



  • Ok, I understand. Don't worry I'm doing the stress testing for you :)
    So on navMove.Reverse(), it seems to reverse the whole path? I see Array.Reverse(waypoints) doing that. But it would be good to tell the AI to move back on the path instead of reversing the whole path. So you could track forward and backward movements on the path.

    Would it be possible if you update the script to pass the updated navMove script directly to me? Waiting for Asset Store to update takes very long..



  • So on navMove.Reverse(), it seems to reverse the whole path?

    No one ever worked with Reverse on navMove, I guess :) I reworked parts of the script and removed the Array.Reverse thing. You can now check the 'Reverse' bool reliably to find out whether the object is moving in the other direction. The 'repeat' bool does not exist anymore.

    Waiting for Asset Store to update takes very long..

    I sneaked the fix into the same live version (5.4.7). It should go live within the next few hours - if you see today's upload date on the Asset Store page, you will know it's the updated version.

    Finally setting this to solved, please search or create new threads if you experiencing any issues :)


Log in to reply