Search Unity

Edit mode, constant rendering update?

Discussion in 'Scripting' started by DaveHoskins, May 13, 2014.

  1. DaveHoskins

    DaveHoskins

    Joined:
    Sep 9, 2013
    Posts:
    190
    Hi, is it possible for a function get to called every frame in edit mode?
    I see lots of posts about updates, but it's always only when something is edited.

    I need this update call for a series of complex RenderTextures over several frames, and I would like to do this in edit mode. I can't use a Co-routine because I'm calling rendering code.

    Thanks,
    Dave.
     
  2. Deleted User

    Deleted User

    Guest

  3. SchneiderAtvis

    SchneiderAtvis

    Joined:
    Feb 19, 2013
    Posts:
    38
  4. DaveHoskins

    DaveHoskins

    Joined:
    Sep 9, 2013
    Posts:
    190
    Thanks guys, the first answers looks promising but I'm not sure about Delegates yet, and the code is confusing at the moment for me(!), but it looks like the correct direction.

    The second link uses:-
    "
    - Update is only called when something in the scene changed.
    - OnGUI is called when the Game View recieves an Event.
    - OnRenderObject and the other rendering callback functions are called on every repaint of the Scene View or Game View.
    "

    Which is not what I wanted, sorry. I needed something that updated on it's own, without the user doing anything.
     
  5. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,775
    Can I ask why you want this in the editor? I only ask because that's usually a very bad idea. You can easily make editing your game scene difficult or impossible.
     
  6. DaveHoskins

    DaveHoskins

    Joined:
    Sep 9, 2013
    Posts:
    190
    OK, when the user edits something, it goes away and renders a texture based on this edit, it's an expensive edit so it's divided up in to 128 individual tasks, and then stops.
    I have the static update working now, thanks.
     
  7. DaveHoskins

    DaveHoskins

    Joined:
    Sep 9, 2013
    Posts:
    190
    Scratch that, I can't use the EditorApplication.update thing as it get's called all over the place, and I specifically needed a render pipe call.
     
    sppAghetti likes this.