this is code at start function that creates listner which automatically calls ResearchInvestmentChange when slider value is changed.
My question is what “delegate” means. I found some info about Delegate which is i guess custom delegate function and here in my code is maybe Mono delegate, but don’t really understand it. Anyone has link or short description what this delegate in code means?
researchInvestment.onValueChanged.AddListener(() => ResearchInvestmentChange());
Delegate UnityAction<float> does not take 0 arguments
researchInvestment.onValueChanged.AddListener(ResearchInvestmentChange());
also doesnt work
but i get what delegate does but still dont get it completely why you have to make fake funtion to call this one, because of return value if it has one or what?
thanks
says cant convert “method group” to “UnityAction”
so delegate is used when you want to call function with another fake function and thats because mono want it like that.
It’s part of the contract agreement you made with the Slider. The Slider will send notifications to a delegate along with the new slider value. You create a function that matches the delegate that the Slider expects to call.
Whether you use it or not is irrelevant. You’re free to ignore it if you don’t need it.
Similarly for toggle buttons, you’d need to create a function that accepts a bool parameter, and so on.
Thanks, yeah, my artist specifically is pushed the art style int he direction he wanted the ludum dare to be… but you know, time crunch on that prototype.
Games coming out real soon. Busy busy crushing bugs.