Search Unity

Frequently subscribing and unsubscribing vs a for loop.

Discussion in 'Scripting' started by Kensei, Sep 22, 2014.

  1. Kensei

    Kensei

    Joined:
    Apr 26, 2013
    Posts:
    63
    Hi, I have a game where many items all need to be moved by the player, but they often get destroyed and spawned. Every item has the exact same behavior. What would be the better control approach here, use events and subscribe/unsubscribe every item to a player controller object, or have the player controller loop over every item of whatever type and move them accordingly?