Error overloading method using an enum - C# (Error CS0663) -
i've got error , can found on web reason. have 3 methods:
public enum go { thatgo, parent, child }; public static void fadeout(this gameobject go, float fadetime) { task t = new task(fadeout(go, fadetime, false, go.thatgo)); new task(taskkiller(20f, t)); } public static void fadeout(this gameobject go, float fadetime, bool destroy) { task t = new task(fadeout(go, fadetime, destroy, go.thatgo)); new task(taskkiller(20f, t)); } public static void fadeout(this gameobject go, float fadetime, bool destroy, go wichdestroy) { task t = new task(fadeout(go, fadetime, destroy, wichdestroy)); new task(taskkiller(20f, t)); }
the first 2 methods works fine, error, when write last (the 1 enum parameter), error:
error cs0663: overloaded method `extensions.fadeout(this unityengine.gameobject, float, bool, extensions.go)' cannot differ on use of parameter modifiers only
i've been searching lot on internet , can't understand why error. welcome..
edit: forgot method fadeout
task t = new task(fadeout(go, fadetime, destroy, wichdestroy));
is not same method above. it's
public static ienumerator fadeout(gameobject go, float time, bool destroygo, go whatgo)
as i've understood comments, have instance method differs return type extension method. problem return type not part of signature while overloading used.
consider case.
public int foo() {} public double foo() {} var num = foo();
which 1 should called? same out , ref parameters.
Comments
Post a Comment