- Home /
How do I animate graphics in a custom EditorWindow ?
If i have an GUI.Label that i want to move from the left to the right of the screen over time then how do I go about doing that.
Better yet what time function should I use to handle time in an editor window ? Many of the function under the Time class only work at gameplay
for example
public class thisclass : EditorWindow
{
private Vector2 graphicPosition = new Vector2(100,100);
void OnGUI()
{
GUI.Label(new Rect(graphicPosition,new Vector2(150,40),"some text");
graphicPosition.x = Mathf.Lerp(graphicPosition.x,500,Time.smoothDeltaTime *0.6f);
}
}
Can you please add some more information. What is it exactly that you are trying to do that you can only do during gameplay? is it because you cant use Time.deltaTime
?
public class thisclass : EditorWindow
{
private Vector2 graphicPosition = new Vector2(100,100);
void OnGUI()
{
GUI.Label(new Rect(graphicPosition,new Vector2(150,40),"some text");
graphicPosition.x = $$anonymous$$athf.Lerp(graphicPosition.x,500,Time.smoothDeltaTime *0.6f);
}
}
what Time.smoothDeltaTime and most of the other function in the Time class wont run outside of a class inheriting from $$anonymous$$onobehavior
Try changing the graphicPosition.x
not from OnGUI, but from Update().
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
How to use addforce after animation? 1 Answer
C# Scrubbing back through an Animation in script 1 Answer
Distribute terrain in zones 3 Answers
Mouse move to control the animation 1 Answer