- Home /
Automatic caching in Mono?
Is there a way to automatically cache all the things that need to be cached upon new C# script creation? Like an option in Mono? I mean the same way it creates Start() and Update(), is there an option I could edit to set it another template with stuff like Transform myTransform = transform etc.
It would also be helpful if you could tell me which are the other GetComponent shortcuts other than transform that I'm not aware of.
I dunno bout you guys but I would find it easier if I had everything cached to begin with and just delete the unnecessary stuff, rather than reminding myself to do it all the time. It's been so many times that I write transform.position or something similar and then realize "oh shit it's not cached!"...
I'm unfamiliar with caching anything other than asset bundles. Start and Update are functions which are only present in classes which inherit from $$anonymous$$onoBehaviour. From what you're asking, it seems like a member variable for a class would do that. Then, you would store the transform from some other script in your class' member variable. Can you show an example of what you mean by caching to allow someone to give you a better answer? @$$anonymous$$ensei
transform as you know it is a shortcut to writing GetComponent(). You do realize the performance hit if you use transform in Update().
As for an example I already gave one in my question.
ins$$anonymous$$d of writing
void Update() transform.position etc.
you are supposed to write
void Start() Transform myTransform = transform
void Update() myTransform.position etc.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Cant get Monodevolop to work 0 Answers
Glitch in Monodevelop for loops!!! 1 Answer
How to increment a Version string everytime Unity is built? 3 Answers