Skip to content

Find files using a specific method on a given class#148

Merged
12joan merged 1 commit into
developfrom
dx/find-files-using-method
Jun 7, 2026
Merged

Find files using a specific method on a given class#148
12joan merged 1 commit into
developfrom
dx/find-files-using-method

Conversation

@12joan

@12joan 12joan commented Jun 7, 2026

Copy link
Copy Markdown
Member

This PR extends the used_by.rb script with the ability to find all files referencing a specific method on the given script. This includes other C# scripts calling this method, in addition to any Unity scenes or prefabs containing UnityEvents referencing this method.

It may return some false positives, but it should return few or no false negatives.

Example

The basic usage of used_by.rb reports four files that reference the FireBullets script.

$ ruby used_by.rb Assets/src/FireBullets.cs
Found 4 file(s) using FireBullets.cs:
  Fire Bullets.prefab
  Turret.prefab
  MentoeHologramBulletsAttackAI.cs
  Turret.cs

If we want to filter these to return only methods that call the BeginFiring method on FireBullets, we can add this as an additional command-line argument.

$ ruby used_by.rb Assets/src/FireBullets.cs BeginFiring
Found 1 file(s) using the BeginFiring method of FireBullets.cs:
  Turret.cs

#no-test

@CLAassistant

CLAassistant commented Jun 7, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@12joan 12joan merged commit 6d45fa6 into develop Jun 7, 2026
12 checks passed
@12joan 12joan deleted the dx/find-files-using-method branch June 7, 2026 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants