Performance Class example code has confusing comments

Open Beginner friendly
#11,603 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
85/100
Issue type
Documentation
Clarity
Clearly specified
Activity status
Stale
Domain
documentation

Research direction

Open the Performance class documentation at the linked page and inspect the custom monitor example. Update the confusing comments so their monitor names match the code shown, then reread the example to confirm that no unexplained “MyName” references remain.

Written by the indexing model from the issue text.

Description

area:class reference bug

4.5.1:

Issue description:
The documentation for the Performance class has example code for adding a custom monitor that refers to the newly added monitor as "MyName", but the code seems to be creating "MyMonitor" instead. This may confuse newer coders into thinking "MyName" is some other variable they didn't know about.

func _ready():
	var monitor_value = Callable(self, "get_monitor_value")

	# Adds monitor with name "MyName" to category "MyCategory".
	Performance.add_custom_monitor("MyCategory/MyMonitor", monitor_value)

	# Adds monitor with name "MyName" to category "Custom".
	# Note: "MyCategory/MyMonitor" and "MyMonitor" have same name but different IDs, so the code is valid.
	Performance.add_custom_monitor("MyMonitor", monitor_value)

	# Adds monitor with name "MyName" to category "Custom".
	# Note: "MyMonitor" and "Custom/MyMonitor" have same name and same category but different IDs, so the code is valid.
	Performance.add_custom_monitor("Custom/MyMonitor", monitor_value)

	# Adds monitor with name "MyCategoryOne/MyCategoryTwo/MyMonitor" to category "Custom".
	Performance.add_custom_monitor("MyCategoryOne/MyCategoryTwo/MyMonitor", monitor_value)

func get_monitor_value():
	return randi() % 25

https://docs.godotengine.org/en/stable/classes/class_performance.html#class-performance

Dominant language
reStructuredText
Stars
5.7k
Forks
3.8k
Avg merge
7d 14h
Merged PRs (30d)
41

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from godotengine/godot-docs

All issues in godotengine/godot-docs

Similar issues

More Documentation issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.