[Unity] Update loop or render event
Hi,
I was wondering of Noesis (for Unity) exposes any sort of render event or update loop so that I can run some physics calculations for Noesis FrameworkElements?
Thanks
I was wondering of Noesis (for Unity) exposes any sort of render event or update loop so that I can run some physics calculations for Noesis FrameworkElements?
Thanks
-
-
sfernandez
Site Admin
- Posts: 3222
- Joined:
Re: [Unity] Update loop or render event
Sorry, but there is no such event in NoesisGUI. Anyway, I think it would be enough to write your code in any MonoBehavior Update/FixedUpdate event. Is there any reason why you can't use these events?
Re: [Unity] Update loop or render event
We need to be able to run physics simulations on the ScrollViewer depending on what the input is. For example, swiping your mouse up and down on the scroll viewer will scroll up and down, but instead of actually scrolling it, we want to add friction to the scrolling, so we need to apply velocity over time, which is why we need an update loop. Making a MonoBehaviour would be a nightmare to coordinate with code behind.
WPF has CompositionTarget.Rendering event which can be used, something similar for noesis would be very useful.
WPF has CompositionTarget.Rendering event which can be used, something similar for noesis would be very useful.
Re: [Unity] Update loop or render event
Yes, we could add the event CompositionTarget.Rendering, although I wonder if there is a better solution for this. For doing something very similar (accelerations and decelerations) we use Manipulation Events, in fact, the event ManipulationDelta is called per frame for that purpose.
Our Scrollviewer is enabling those events by setting IsManipulationEnabled to true. Right now, this only works for Touch events. If they worked also for mouse events will it be a valid solution for you?
Our Scrollviewer is enabling those events by setting IsManipulationEnabled to true. Right now, this only works for Touch events. If they worked also for mouse events will it be a valid solution for you?
Re: [Unity] Update loop or render event
We were initially going to use manipulation events, but we also want to be able to control the physics ourselves so that's why we're implementing it ourself. Specifically adding things like drag so the view kind of lags behind the mouse when we scroll. CompositionTarget.Rendering would be best as we can also adapt this to other controls in the future (including custom controls).
Re: [Unity] Update loop or render event
Understood, please file a bug about this. Thanks!
Re: [Unity] Update loop or render event
Hi , is there any update on the subject?
seems like there is no CompositionTarget.Rendering in noesis.
I want to do a time based movement of an image inside a canvas.
I need
- a way to get the elapsed time between frame ( the noesis way )
- an update loop (or rendering event ) where i can calculate new position based on speed an time. ( the noesis way )
I know i can collect info in monobehaviour update method an pass it to noesis canvas
but i wanted to be sure there is not a better way (integrated in noesis) to achieve this
thank
seems like there is no CompositionTarget.Rendering in noesis.
I want to do a time based movement of an image inside a canvas.
I need
- a way to get the elapsed time between frame ( the noesis way )
- an update loop (or rendering event ) where i can calculate new position based on speed an time. ( the noesis way )
I know i can collect info in monobehaviour update method an pass it to noesis canvas
but i wanted to be sure there is not a better way (integrated in noesis) to achieve this
thank
-
-
sfernandez
Site Admin
- Posts: 3222
- Joined:
Re: [Unity] Update loop or render event
The View exposes a Rendering event that is called on each view update, and changes made to the UI tree in that event handler will be processed in that same frame.
That event doesn't expose the elapsed time as it receives an EventArgs instance, although investigating this now I just discovered that WPF is in fact passing there an instance of a RenderingEventArgs which provides the RenderingTime (not the elapsed, but the actual update time). Could you please create a ticket in our bugtracker referencing this so we can implement it correctly?
In the meantime, to get the time in Unity you can use Time.time, as that is the time we are using to update the View and it'll be the same you would receive from the Rendering event.
That event doesn't expose the elapsed time as it receives an EventArgs instance, although investigating this now I just discovered that WPF is in fact passing there an instance of a RenderingEventArgs which provides the RenderingTime (not the elapsed, but the actual update time). Could you please create a ticket in our bugtracker referencing this so we can implement it correctly?
In the meantime, to get the time in Unity you can use Time.time, as that is the time we are using to update the View and it'll be the same you would receive from the Rendering event.
Who is online
Users browsing this forum: Google [Bot], Semrush [Bot] and 3 guests