i added unity sentis to my game and it changed how the enemies feel to fight in a way i could not explain until i saw the data
I had been using NavMesh and state machines for enemy AI in Unity for four years. The enemies worked. Playtesters never complained about the AI specifically. When I added a Sentis powered vision system to my enemies after three months of learning it, playtesters started describing the enemies as feeling smarter without me prompting them. This is what I added, how it changed the enemy behavior, what the playtester comments were before and after, and the honest six week timeline it took to get there.
Google Colab
Used for training the ONNX model for the vision system, free tier
colab.research.google.com
Priya Nair
June 26, 2026
What I added: a trained neural network running inside Unity via Sentis that processes six geometric input values every 0.1 seconds to determine what visibility zone the player occupies relative to the enemy. Not a raycast. A classifier that considers the angle to the player, the distance, the occlusion geometry between them, and two cover quality scores for the enemy and player positions simultaneously. The system takes all six values and outputs a visibility confidence score. Enemies that use this system behave differently in partial occlusion situations than enemies using my old raycast detection.
What the Old Raycast Detection Could Not Do
A raycast check for enemy visibility is binary. Either the ray hits the player or it does not. Real vision does not work like this. If a player is half behind a crate the raycast either hits or misses based on the exact geometry of the moment. Enemies would sometimes instantly detect a player who was 90 percent concealed because one corner of the hitbox was exposed to the raycast origin. They would sometimes fail to detect a player who was mostly visible because the specific ray angle missed the exposed portion. Players described this as enemies feeling inconsistent. The Sentis classifier considers multiple signals together and returns a confidence value rather than a binary result. Enemies with a 0.4 visibility confidence act like they think they heard something. Enemies with 0.9 confidence treat the player as fully detected. The graduated response changes how encounters feel.
The Six Week Implementation Timeline Honestly
- Week 1, understanding Sentis: Spent the first week reading the Sentis documentation, installing the package, and running the example scenes. Did not write any project code this week. Just understood what Sentis was and what kind of model I would need to build.
- Week 2, defining the input features: Decided on the six input values. Angle to player in degrees, distance normalized to detection range, occlusion value from 0 to 1 based on raycast hits, cover quality at player position, cover quality at enemy position, and time since last player sighting in seconds. Wrote a data collection script to record these values and label them with the correct visibility class.
- Week 3, generating training data and training the model: Played my game for four hours while the data collection script recorded labeled examples. Generated 2,400 labeled examples. Trained a three layer classifier in Google Colab on the free tier. Training took 22 minutes. Exported to ONNX format.
- Week 4, Sentis integration: Wrote the EnemyVisionSentis.cs component in Cursor. Hit the tensor memory leak problem. Fixed it. Hit the layer name mismatch problem. Fixed it. By end of week 4 the inference was running and returning values.
- Week 5, connecting to behavior: Replaced the binary raycast in the enemy state machine with a confidence threshold system. Confidence above 0.85 triggers full alert. Confidence between 0.4 and 0.85 triggers an investigate state where the enemy moves cautiously toward the last known location. Below 0.4 the enemy continues patrol.
- Week 6, testing and playtesting: Ran 8 playtesting sessions with the new vision system. Collected feedback. Tuned the confidence thresholds based on playtester behavior patterns.
What Playtesters Said Before and After
- Before Sentis, common feedback: sometimes the enemies just see you through walls, I feel like the detection is random, I can never tell if the enemy has spotted me or not.
- After Sentis, common feedback: the enemies feel smart, it is satisfying to hide just in time, I can tell when an enemy is suspicious of me which is fun to play with.
- The specific moment playtesters mentioned most: the investigate state where the enemy moves toward the player's last known position at reduced speed. This did not exist in the old system. It came from having a graduated confidence value rather than a binary detection.
Performance Numbers
- Inference time per call on GPU backend: 1.8 milliseconds average on my RTX 3070 development machine.
- Inference time on CPU backend on a mid range test device: 12 milliseconds average. Still fast enough for 0.1 second update intervals.
- Number of enemies running inference simultaneously in my target scenario: 6. Total GPU time per update cycle: approximately 11 milliseconds across all six. Well within frame budget.
- Memory leak before fix: frame rate dropped from 120 to 85 over 15 minutes of play. Memory leak after fix: no measurable frame rate change over 45 minutes of continuous play.
Mistakes Across Six Weeks
- Collecting training data without varying my own playstyle: I played conservatively when collecting data. The model trained on conservative player behavior performed poorly when a playtester played aggressively. Added a second training data collection session playing aggressively. Diversity in training behavior matters.
- Not normalizing input values before training: I fed raw distance values in Unity units into the model. The distance range from 0 to 20 dominated the other features in the classifier. Normalized everything to 0 to 1 range and model accuracy improved significantly.
- Running inference every frame instead of every 0.1 seconds: First implementation ran inference in Update. 60 inference calls per second per enemy. Added a timer to run every 0.1 seconds. Reduced GPU load by 85 percent with no perceptible change in enemy behavior.
Final Thoughts
Six weeks to a Sentis powered vision system that changed how playtester feedback describes my enemies. The word smarter appearing in unsolicited feedback after the change is the result I was looking for. Sentis required real learning investment. The tensor management, the Python training pipeline, the ONNX integration. But the outcome is an enemy AI behavior that I genuinely could not achieve with the scripted detection system I had been using for four years. For that specific capability, the six weeks was worth it.