Is it potential to desynchronize Application.targetFrameRate
and Monobehavior’s Update()
from the graphics output rendering price of a UI Document, Panel, Game Object holding it, or world Unity app?
Let’s say you’ve got a UI Document on a sport object. Let’s say you might be monitoring through customized code for when there’s truly any change within the visible show that should happen.
Let’s say you ABSOLUTELY KNOW NOTHING ANYWHERE IS CHANGING within the show (both domestically on the UI Document / Game Object / Panel stage and even Globally on the software stage – no visible adjustments in any respect). It is a totally static show at the moment.
Can you throttle down the rendering price of the UI Toolkit / Game Object / Panel / Project (even proper all the way down to zero) with out altering Application.targetFrameRate
?
I can throttle Application.targetFrameRate
down fairly low to round 15 fps when no visible adjustments are occurring and bump it again up when extra is occurring. But I can not throttle it down additional or I will not catch replace occasions effectively like new clicks/releases.
On the opposite hand, once I know there isn’t any visible change, I may throttle the RENDERING price all the way down to zero hypothetically, since no new show rendering must happen.
Is there any approach to do that? Or does it not make sense? I do not understand how UI Toolkit or Unity renders the ultimate app visible output.
Background Questions:
If you make a non-changing visible ingredient based mostly show after which depart it idling on a display screen at 120 fps:
- What is updating each body?
- Is it re-calculating the flexing for the panel each body?
- Is it re-drawing all the weather each body?
- Is it continuously checking all its fields each body fps for updates and solely re-drawing if one is discovered?
If such a code could be executed to throttle rendering with out throttling the app’s world price, a take a look at instance for example could be say hypothetically:
VisualElement ve;
float frameRate = 120;
void Awake(){
Application.targetFrameRate = frameRate;
ve = new VisualElement();
GetComponent<UIDocument>().rootVisualElement.Add(ve);
StartCoroutine(updateTest());
}
IEnumerator updateTest(){
//request a random change to look of visible ingredient on display screen at body price
ve.fashion.Color = new Color(UnityEngine.Random.Range(0,1), UnityEngine.Random.Range(0,1), UnityEngine.Random.Range(0,1));
ve.fashion.width = ve.fashion.peak = UnityEngine.Random.Range(2,500);
Debug.Log(1/Time.deltaTime); // ought to proceed to output round frameRate
yield return null;
}
void Update(){
if (Input.GetMouseButtonDown(0)){
runFunctionToThrottleRendering(); //hypothetical operate that may then throttle the rendering pipeline
}
Is there any approach to command within the panel or Unity background code that may enable me to activate/off updates or change the speed of updates to the Panel/UI Document/rendering pipeline from the UI Toolkit so you’ll now not see the random adjustments (even whereas the instructions proceed within the background on the price of Update()
)?
ie. So if I have been to set off this command, the updateTest()
can maintain operating at 120 fps however it would now not render any new adjustments to the visible output and the show will stay static?
(Obviously I may throttle or activate/off the coroutine’s operate internally however this isn’t what I’m asking – the code is only a hypothetical illustrative instance.)
There are lengthy intervals when somebody is likely to be studying or an unchanging display screen in an app, and as I mentioned, I can throttle the Application.targetFrameRate
fairly low in these instances. But ideally, I may even shut off any visible updates occurring to the display screen in any respect (or background checks contained in the UI Toolkit code) since I do know completely none have to happen at these occasions.
I’m even in strategies I must entry by Reflection. I do not thoughts. I’d even be focused on strategies that may do it only for UI toolkit or a panel and even globally for all of Unity.
Any ideas are appreciated.