- Home /
Should I use a static function for this?
I am going to make a function that simply returns the point on a plane at which a line intercepts.
It seems to me like basically a mathf function almost so a good canidate for static.
thoughts? Not sure how bad global functions are considered.
If you need it in multiple script I think static function is a good idea.
Your function is like $$anonymous$$ath function so, I think your idea is good. Just don't use static for everything. In some case like this one it's a good thing to do rather than repeat a code or declared an object to used its public method.
http://bytes.com/topic/c-sharp/answers/269384-why-use-static-function
Answer by sparkzbarca · Nov 21, 2012 at 04:44 PM
If you need it in multiple script I think static function is a good idea.
Your function is like Math function so, I think your idea is good. Just don't use static for everything. In some case like this one it's a good thing to do rather than repeat a code or declared an object to used its public method.
http://bytes.com/topic/c-sharp/answers/269384-why-use-static-function
Your answer
Follow this Question
Related Questions
Find 2D Texture via Script to use in Static Function 2 Answers
Adding static functions 2 Answers
C# script for calculating the distance between the player and objects 1 Answer
Member variables returning to 0 0 Answers
Function can't be called 0 Answers