Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Using a Timeline on prefabs

Discussion in 'Timeline' started by Aequitatis, Aug 25, 2017.

  1. Aequitatis

    Aequitatis

    Joined:
    Jan 24, 2014
    Posts:
    12
    Hello!

    In my game, enemies use the navigation framework to run for an exit. One of the paths involves a navmesh link - the enemy jumps on to a trampoline and bounces to a higher level. I thought this jump, jump, land animation would be a good use for timelines, so I've tried it out.

    I'm having trouble. The enemies are created at run time, so how do I create the timeline with a prefab? If I try dragging the prefab on to the timeline I get a "object is disabled" message. I've tried putting the director on the enemy, but that seems a poor place to put it as the timeline has to animate the enemy (animation and translation) and the trampoline (animation). It will also likely have to deactivate the nav agent and reactivate it, but I haven't got that far yet.

    Thanks for the help!
     
  2. Andy-Touch

    Andy-Touch

    A Moon Shaped Bool Unity Technologies

    Joined:
    May 5, 2014
    Posts:
    1,009
    Will the Playable Director component be added to an object in the scene (Such as the Trampoline) or on to the enemy Prefabs that are spawned runtime?
     
  3. Aequitatis

    Aequitatis

    Joined:
    Jan 24, 2014
    Posts:
    12
    I'm flexible on where it goes, as long as it works. My levels are contained areas within my scene - several levels per scene. I would ideally like the Playable Director to be attached to the level, as that is the most logical container.

    Another complication is that the level area is also spawned at runtime when the player explores their way to the right location. So yes, one prefab level spawns prefab enemies. How would you suggest I structure this?
     
  4. Aequitatis

    Aequitatis

    Joined:
    Jan 24, 2014
    Posts:
    12
    Bump. Is there a recommended way to resolve this? I basically want a timeline to target a prefab rather than a scene object.

    I could potentially have a "silent enemy" that I activate, run the timeline, deactivate and then move the original enemy into the new position so it appears seamless, but I would prefer not to hack it if I can help it. Thanks!
     
  5. hereder

    hereder

    Joined:
    Apr 28, 2017
    Posts:
    165
    bump again:
    I want my player to be able to walk up to a box and press F, this should trigger a timeline where the player get on top of the box, and then continue from there... Like a "mini cutscene".