#Is it possible to pass extra parameters into function pointers?
1 messages · Page 1 of 1 (latest)
no, it's strongly fixed by declaration of delegate
also, judging from names of example it looks like you plan to burst compile such little methods
if that's the case I heavily advice against it, because cost of calling function pointers is pretty high
thats true. have noticed the heavy dip in performance delegates have
what do you think is a decent alternative in that case? it would be best if i could still control some perameters which are going into the function
don't use function pointers at all
write all your logic normally
also have only one entry point
basically, do prep work in managed context
pass that data to burst compiled method
so like a switch statement or something?
get data back
Your entry point is going to be static function
so write everything using all C# power (in burst compatible manner ofc)
you don't have classes in burst
sorry i mean struct
I don't get the question
public static bool Block(int point,int pos,int scale) => (point >= pos && point < pos + scale); is used to check wether a point is inside or outside a given area
but it would be useful if this was dynamic so i could check if something is inside a sphere etc.
and this is done around 500 or so times checking different points
then write different method for that
yes but then how could i put this in the same native array for example
it heavily depends on what you are doing
but the way I see it
you are trying to force object oriented practice here
it might work, or it might not work depending on context
but you probably should just rethink design
i see