4 ms·
Here's a good use of something close to a singleton. Different things will initialize the class, and you want to keep track of the last one initialized, so that
by jimmaswell 13y ago
Here's a good use of something close to a singleton. Different things will initialize the class, and you want to keep track of the last one initialized, so that's what you assign to the static T Instance. I used this for a component that could be added to something, but the Update function of which should only run for the latest initialization.
- gohrt 13y ago> Different things will initialize the class, and you want to keep track of the last one initialized, In that sentence, only the class is being initialized, so there's nothing to track. What did you mean? "Instantiate", not "initialize" ?
- jimmaswell 13y agoyes, Instantiate. the class's Update had if (Instance != this) return;