Skip to content

Instantly share code, notes, and snippets.

@JaiParakh
Last active January 13, 2026 16:28
Show Gist options
  • Select an option

  • Save JaiParakh/8313d911ed3a3411cd59b1c4065c9036 to your computer and use it in GitHub Desktop.

Select an option

Save JaiParakh/8313d911ed3a3411cd59b1c4065c9036 to your computer and use it in GitHub Desktop.
void checkAllSmells()
{
// Fetches all smell sources in the scene.
SmellSource[] all_smells = FindObjectsOfType<SmellSource>();
// We can multiple smell sources in our game
foreach (SmellSource smell in all_smells)
{
// We calculate the intensity of the smell here
float intensity = smell.getSmellIntensityAt(transform.position);
// Add your logic here
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment