Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion skills/localization/resources/L10nBatchProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using UnityEngine.Events;
using UnityEngine.Localization.Components;
using System.Collections.Generic;
using System.Linq;
using TMPro;

/// <summary>
Expand Down Expand Up @@ -61,14 +62,22 @@ static List<string> LocalizeHierarchy(
labels.AddRange(Object.FindObjectsByType<TMP_Text>(
FindObjectsInactive.Include, FindObjectsSortMode.None));

// Longest key first. A label reading "NO ITEMS FOUND" must bind to that key rather
// than to a shorter "NO" that is a substring of it -- the case SKILL.md's mapping
// guidance calls out. Dictionary enumeration order is unspecified, so without this
// the binding is not just wrong but irreproducible; and because the loop below breaks
// on the first hit and marks the label matched, a mis-binding never surfaces in the
// unmatched report. Sorted once here rather than once per label.
var ordered = mapping.OrderByDescending(e => e.Key.Length).ToList();

foreach (var label in labels)
{
// Read the current string from whichever family this component belongs to.
var current = label is Text legacy ? legacy.text : ((TMP_Text)label).text;
if (string.IsNullOrEmpty(current)) continue;

var matched = false;
foreach (var kvp in mapping)
foreach (var kvp in ordered)
{
if (!current.Contains(kvp.Key)) continue;

Expand Down
2 changes: 1 addition & 1 deletion skills/physics-3d-collision/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,6 @@ Attach [CollisionDebugger.cs](resources/CollisionDebugger.cs) to both objects in

---

## 11. Troubleshooting & Resources
## 11. Resources

-> [references/troubleshooting.md](references/troubleshooting.md)
35 changes: 1 addition & 34 deletions skills/physics-3d-collision/references/troubleshooting.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,4 @@
# Troubleshooting & Resources

## Troubleshooting Table

| Symptom | Likely Cause | Fix |
|---|---|---|
| No callback, no Rigidbody on either object | Two static colliders never generate callbacks | `Rigidbody` should be added to the moving object |
| `OnCollisionEnter` never fires on a player character | Player uses `CharacterController` instead of `Rigidbody` | Use `OnControllerColliderHit(ControllerColliderHit hit)` instead |
| Callback fires in Editor, silent in build | IL2CPP stripping MonoBehaviour | `[Preserve]` should be added, or a `link.xml` created |
| Callback fires once then stops | Rigidbody fell asleep | `Rigidbody.WakeUp()` should be called before applying force |
| `OnTriggerStay` / `OnCollisionStay` stops mid-session | Rigidbody fell asleep inside trigger or on collider | `Rigidbody.WakeUp()` should be called, or the sleep threshold reduced |
| All physics frozen — AddForce, gravity, callbacks all silent | `Time.timeScale` is `0` | Set `Time.timeScale = 1f` |
| Trigger fires but `OnCollisionEnter` does not | `isTrigger` is enabled | **Is Trigger** should be disabled if physical blocking is needed |
| Raycast hits everything except the target | Target layer excluded from layerMask | `target.layer` should be logged and the mask verified |
| Raycast hits nothing at all | Origin inside a collider | The ray origin should be offset; `Physics.OverlapSphere` can find enclosing colliders |
| Raycast misses the inside face of a wall or hollow mesh | Back-face hits disabled by default | Enable **Queries Hit Backfaces** in Edit > Project Settings > Physics |
| Two kinematic objects never interact | Kinematic × Kinematic produces no `OnCollisionEnter` | At least one should be made Dynamic, or triggers used |
| Fast bullet passes through wall | Tunneling — Discrete mode skips thin colliders | `Continuous Dynamic` should be used; or `Physics.SphereCast` for bullets |
| Ghost collisions (phantom hits before contact) | `Continuous Speculative` over-predicts contacts | `Continuous Dynamic` should be used for object-vs-object |
| Dynamic object with MeshCollider produces no callbacks | Non-convex MeshCollider on dynamic Rigidbody silently ignored | **Convex** should be enabled or compound primitives used |
| Two mesh objects never collide | Two non-convex MeshColliders cannot collide in PhysX | At least one should be made Convex; primitives used for the simpler shape |
| Collision fires at the wrong point on mesh | Convex hull diverges from visual mesh on concave shapes | Expected — hull contact only; visualized in Scene view (Gizmos > Physics) |
| Objects launch apart on the first frame | Colliders overlapping at simulation start — depenetration spike | Colliders should be shrunk so none overlap at spawn |
| Collider on child not part of parent physics body | Child has its own Rigidbody, splitting the compound | The unintended child Rigidbody should be removed |
| Collision stopped working after respawn or pool return | `Physics.IgnoreCollision` is per-instance | `Physics.IgnoreCollision` should be re-called on `Awake` / `OnEnable` |
| Objects outside a concave mesh pass through it | MeshCollider inverted normals — contacts deflect inward | Normals should be fixed in the DCC tool, or Convex enabled |
| Collider shape wrong despite looking correct in Scene view | Non-uniform scale on parent distorts child colliders | Scale should be applied in DCC tool so root arrives at `(1,1,1)` |
| Raycast misses a collider moved this frame | Physics broadphase not updated after `transform.position` write | `Physics.SyncTransforms()` should be called immediately after the position change |
| Objects stop with a visible gap before touching | Contact Offset skin gap | `Default Contact Offset` should be reduced carefully in Project Settings; very low values can reduce stability |

---

## Resources

# Resources
- [Unity Manual: Collision callbacks and Rigidbody interaction](https://docs.unity3d.com/Manual/CollidersOverview.html)
- [Unity Manual: Layer Collision Matrix](https://docs.unity3d.com/Manual/LayerBasedCollision.html)
- [Unity Manual: Physics.Raycast](https://docs.unity3d.com/ScriptReference/Physics.Raycast.html)
Expand Down