To solve the problem "enemy stops at the second waypoint", I add "destinationReached = false;" in PathFinder.SetTarget. Hopefully can help people who are also bothered by the problem. Btw, great thanks to @ Stevie ROF ! It is the first time I learn to make games, and your videos really help me a lot! Best wishes!
@lagmoore5550
4 жыл бұрын
@Stevie ROF I've been following all your tutorials from E1 and I must say, you are a beast. Your work is amazing and thank you so much for sharing your videos with us all. Thanks to you I actually find it fun learning more about Unity. Keep up the good work! I noticed that you have created a SpawnPointController, which you must have done off-cam as well as a few other changes. No problem, I understand that it aint easy keeping track of what code edits you have done in one video but I'm struggling with getting my player to move position when it should respawn. The player respawns and deactivates the rigidbody and enables the animations, but it doesnt move to the spawnpoints we made in a previous episode. It just stands up looking confused af. Any suggestions? I think the problem has to do with: transform.position = spawnPoints[spawnIndex].transform.position; transform.rotation = spawnPoints[spawnIndex].transform.rotation; in SpawnAtNewSpawnPoint ()
@stevie_rof
4 жыл бұрын
Dennis Enström hi Dennis, thank you for your message. I’m very happy to learn that my videos made you like coding a bit more fun! Now, did I miss the code for spawning? Indeed, it’s hard to keep track. But, if I understand you correctly, your enemy spawns but does nothing? I believe I only showed spawning and not really used that in later videos anymore. Does your enemy have a patrolling path? Are his scanners working?
@stevie_rof
4 жыл бұрын
Oh duh- now I just read your message. You’re taking about respawning the player. I’ll have to take a look. Might do a video on that topic. (It has been waaayy to long)
@RinoSss
6 жыл бұрын
[FIXED] for anyone has problems like skipping waypoints. In the PathFinder.cs go and make sure destinationReached and SetTarget of your script are like these: 1. bool m_destinationReached; bool destinationReached { get { return m_destinationReached; } set { m_destinationReached = value; if (m_destinationReached != false) OnDestinationReached(); } } 2. public void SetTarget(Vector3 target) { destinationReached = false; Agent.SetDestination(target); }
@NowWeWake
4 жыл бұрын
It can also happen that agent.SetDestination(targetDestination) doesn't update agent.remainingDistance to refer to the new targetDestination until a few frames later. This was my bug. The way to fix it is to also check if (agent.pathPending) in your Update loop. If the agent is still computing the new path, don't check your condition!
@sgmonda
6 жыл бұрын
These videos are fantastic. Thank you very much for sharing your knowledge. I'm learning a lot! :-)
@duane7032
3 жыл бұрын
Great Tutorial Thanks !
@jonasvirsila4179
6 жыл бұрын
Hi Steve, amazing video, still having problem with the AimAngle. My character doesn't even aim up and down. So I posted to forum, waiting for the answer and I tried to reinstall Unity but the problem remains. However, the patrol of the enemy works perfectly, also had the problem of pathfinder not assigned. Changed the void Start() to void Awake() in PathFinder.cs and added DestinationReached = false; in the SetTarget() method and it works perfectly. The enemy character patrols perfectly: goes from 1 point, to second and so on! So don't know what's with your problems in PathFinder.cs guys, just try to change the void Start() to void Awake() and add DestinationReached = false; And that's it. Thanks again! ;)
@muumu7346
6 жыл бұрын
Thx. It did well
@sopranos9062
6 жыл бұрын
i get this error UnassignedReferenceException: The variable Agent of Pathfinder has not been assigned.
@tjones0808
6 жыл бұрын
i am also getting this, did you ever fix?
@mehtabnaseer8590
4 жыл бұрын
use awake function instead of start
@davidgibert8982
6 жыл бұрын
Hi Stevie, hi guys I'm following the tutorial with unity 2017. I had an error in the console [ UnassignedReferenceException: The variable Agent of PathFinder has not been assigned. You probably need to assign the Agent variable of the PathFinder script in the inspector. UnityEngine.AI.NavMeshAgent.SetDestination (Vector3 target) (at C:/buildslave/unity/build/artifacts/generated/common/modules/AI/NavMeshAgentBindings.gen.cs:35) PathFinder.SetTarget (Vector3 target) (at Assets/Shared/PathFinder.cs:37) EnemyPatrol.WaypointController_OnWaypointChanged (.Waypoint waypoint) (at Assets/Scripts/NPC/EnemyPatrol.cs:31) WaypointController.SetNextWaypoint () (at Assets/Shared/WaypointController.cs:25) EnemyPatrol.Start () (at Assets/Scripts/NPC/EnemyPatrol.cs:20) ] that solved by modifying the execution order of the scripts. 1st - PathFinder 2nd - WaypointController 3rd - EnemyPatrol Now I do not see any error in the console but EnemyPlayer stops in the second waypoint. Does anyone have any idea what my problem might be? I have reviewed the videos several times and the scripts are correctly written. Sorry for my english! Greetings,
@hesx4568
3 жыл бұрын
To solve the problem "enemy stops at the second waypoint", I add "destinationReached = false;" in PathFinder.SetTarget. Hopefully can help people who are also bothered by the problem.
@mehtabnaseer8590
4 жыл бұрын
The Person who got the following error should use awake function instead of start UnassignedReferenceException The variable agent of Path finder has not be assigned...
@duane7032
3 жыл бұрын
@Stevie I can get the NPC to move to the 1st and Second Waypoint but then it stops and does not continue. Any Ideas ? I will keep checking the Code in the Meantime for a solution.
@stevie_rof
3 жыл бұрын
Are you resetting the waypoint back to 0 after he is at the last? Could be that you arent checking the last index properly.
@duane7032
3 жыл бұрын
@@stevie_rof I fixed it now silly mistake my Bad !
@gamingmonster6543
6 жыл бұрын
Stieve, when you continue the lesson?
@stevie_rof
6 жыл бұрын
GamingMonster well, this episode isn't the current last (46 as of this date, and this is 30)
@PakGrantChristie
8 жыл бұрын
Hi Stevie - About the pathfinder - I have added 2 enemies using the same pathfinder and waypoints. As soon as they get close they become stuck not moving - like in gridlock. Can objects share the same pathfinder and waypoints - thanks in advance.
@PakGrantChristie
8 жыл бұрын
Sorted it. What I did was wrong was have nav mesh radius set way too large and as they all converged they got stuck. Now they walk around in a pack so yay!
@stevie_rof
8 жыл бұрын
Cool, thanks for sorting it out!
@jodyruben4097
7 жыл бұрын
i think there is something that you not show some changes in pathfinding scripts?
@stevie_rof
7 жыл бұрын
Is there? What do you think that is?
@jodyruben4097
7 жыл бұрын
i think destinationReach = false; part are not coverage in this video either pathfinding/scanner video. and i got some issue that the enemy player skip some waypoint , and it just happen sometimes.
@jodyruben4097
7 жыл бұрын
Nevermind. For anyone who questioning the same question as me, Stevie will coverage in some next video. Thanks alot for the tutorial :)
@gamingmonster6543
7 жыл бұрын
How to draw no sharp angles? How to make curves and smooth lines? (Bezier lines)
@NathanAust29
4 жыл бұрын
Hi Using unity 2019.2.18 Assets\Shared\WaypointController.cs(31,16): error CS0029: Cannot implicitly convert type 'Waypoint' to 'Waypoint[]
@NathanAust29
4 жыл бұрын
my bad, i used "GetComponent" not "GetComponents". Great Tutorial btw mate.
@peterquill726
6 жыл бұрын
Hi steve, I have a weird bug; my way points work fine, but if the next waypoint is on the 'right' side of the current way point, my enemy will not reach that waypoint, it will move toward that waypoint a little and continue to the next one after. I debug the 'Agent.distance remaining' and it said that the remaining distance is less than the threshold while it obviously not(by looking with my eyes).
@peterquill726
6 жыл бұрын
I found the reason. it seems like the problem waypoint is position near the empty gameobject waypointController so the remaining distance debug the distance between waypointcontroller and that waypoint. After I move waypoint controller out of the range it works fine again. why is this happening though?
@stevie_rof
6 жыл бұрын
Peter Quill hm, that shouldn't be a problem. I will take a look at it later on.
@NowWeWake
4 жыл бұрын
@@stevie_rof @Peter Quill It can also happen that agent.SetDestination(targetDestination) doesn't update agent.remainingDistance to refer to the new targetDestination until a few frames later. This was my bug. The way to fix it is to also check if (agent.pathPending) in your Update loop. If the agent is still computing the new path, don't check your condition!
@stevie_rof
4 жыл бұрын
@@NowWeWake good one. Thanks
@dracs5929
6 жыл бұрын
VERY NEW to scripting, how do i get the camera to follow my Y axis. i can look left and right fine but i cant look up and down. My character can but i cant. is there a fix????????????
@stevie_rof
6 жыл бұрын
Dracs you should probably rotate along the character transform.right to get that rotation. I would however suggest to continue the video 'as is' especially if you are just into programming. At the end you will most likely be able to make these changes yourself. It's likely thay any changes you may do now might introduce conflicts in another video.
@jack-xx8ff
7 жыл бұрын
when the game starts after adding enemy patrol an error occurred UnassignedReferenceException: The variable Agent of pathfinder has not been assigned.You probably need to assign the agent variable of the pathfinder script in the inspector
@dominiauk
7 жыл бұрын
I get this same issue, however it is going through the "start" method of "PathFinder" and setting the Agent variable. So very odd. However changing the "start" method to an "awake" method seems to resolve it. Maybe something in unity 2017?
@jodyruben4097
7 жыл бұрын
part of getting reference to NavMeshAgent you can use gameObject.GetComponent(); in unity 5 i think it should be like this , and navmesh move to unity library AI :D
@jack-xx8ff
7 жыл бұрын
error has automatically gone but now enemy walk up to 2nd point and stop walking
@kevinchirayath635
6 жыл бұрын
What you need to do is in PathFinder.cs change the Start function to an awake function. You want to call the navmeshagent on awake, not start.
@firatak1405
4 жыл бұрын
@@kevinchirayath635 Brother thanks for your helping. But enemyplayer still does not move after the second point. Do u have any idea about that?
@gamingmonster6543
7 жыл бұрын
How to use for different enemies, will not they all interfere with each other? How to assign each enemy their waypoints?
@stevie_rof
7 жыл бұрын
GamingMonster we assign different paths to different enemies later on.
@gamingmonster6543
7 жыл бұрын
Oh thanks Excellent lessons
@gamingmonster6543
7 жыл бұрын
when there will already be a lesson and solution?
@ZICKFREED
6 жыл бұрын
@@stevie_rof hi, good day, im waiting this lesson(
@alexkenway4334
8 жыл бұрын
will u make another videos
@stevie_rof
8 жыл бұрын
yes, almost ready with a new one.
@alexkenway4334
8 жыл бұрын
Stevie ROF yeah will u update it now
@stevie_rof
8 жыл бұрын
Egy Droid in a couple of hours. I still need to make a few edits.
Пікірлер: 55