Kaihyo
Kaihyo
CC#
Created by Kaihyo on 2/6/2025 in #help
Creating a delegate that accept a ref from a struct method
"It's nearly impossible/very complicated to do" is an OK answer. I needed argument to discuss it with my team
23 replies
CC#
Created by Kaihyo on 2/6/2025 in #help
Creating a delegate that accept a ref from a struct method
The rest is fine, I got most of the drawing/data update working, but struct are a PIA for some use cases haha
23 replies
CC#
Created by Kaihyo on 2/6/2025 in #help
Creating a delegate that accept a ref from a struct method
Yeah, for struct using a PropertyDrawer that relies on SerializedObject would make more sense (it would make even more sense for people to stop trying to listen for changed made on a struct).
23 replies
CC#
Created by Kaihyo on 2/6/2025 in #help
Creating a delegate that accept a ref from a struct method
Yes. It's for people who want quick formatting without inspector code or Odin.
23 replies
CC#
Created by Kaihyo on 2/6/2025 in #help
Creating a delegate that accept a ref from a struct method
I'm not trying to serialize the delegate. It just creates a schedule in the inspector that will call the getter (ShowIf in the example) and then invoke a callback using the output.
23 replies
CC#
Created by Kaihyo on 10/23/2023 in #help
❔ Building a delegate with a Type and a MethodInfo keeps throwing ArgumentException
That was the issue, i was missing the instance. Thanks for the help 🙂
22 replies
CC#
Created by Kaihyo on 10/23/2023 in #help
❔ Building a delegate with a Type and a MethodInfo keeps throwing ArgumentException
And I think that's what I was missing
22 replies
CC#
Created by Kaihyo on 10/23/2023 in #help
❔ Building a delegate with a Type and a MethodInfo keeps throwing ArgumentException
Yes
22 replies
CC#
Created by Kaihyo on 10/23/2023 in #help
❔ Building a delegate with a Type and a MethodInfo keeps throwing ArgumentException
But thanks to you I know that it's a unity issue now and apparently the method needs to be a static method
22 replies
CC#
Created by Kaihyo on 10/23/2023 in #help
❔ Building a delegate with a Type and a MethodInfo keeps throwing ArgumentException
It's not like a game which I could decide if it's il2cpp or mono unfortunately 😦
22 replies
CC#
Created by Kaihyo on 10/23/2023 in #help
❔ Building a delegate with a Type and a MethodInfo keeps throwing ArgumentException
Well, since it's code to modify the editor behaviour, I'll suppose it depends on what unity is running on
22 replies
CC#
Created by Kaihyo on 10/23/2023 in #help
❔ Building a delegate with a Type and a MethodInfo keeps throwing ArgumentException
That's bothersome
22 replies
CC#
Created by Kaihyo on 10/23/2023 in #help
❔ Building a delegate with a Type and a MethodInfo keeps throwing ArgumentException
I suspected it could be linked to this
22 replies
CC#
Created by Kaihyo on 10/23/2023 in #help
❔ Building a delegate with a Type and a MethodInfo keeps throwing ArgumentException
Yes, it's within unity for editor code
22 replies
CC#
Created by Kaihyo on 10/23/2023 in #help
❔ Building a delegate with a Type and a MethodInfo keeps throwing ArgumentException
I didn't make the method generic because I won't know the element type in every scenario. But here is the full exception
ArgumentException: method arguments are incompatible
System.Delegate.CreateDelegate (System.Type type, System.Object firstArgument, System.Reflection.MethodInfo method, System.Boolean throwOnBindFailure, System.Boolean allowClosed) (at <cbc72d4a9767498db39486e941a498e3>:0)
System.Delegate.CreateDelegate (System.Type type, System.Reflection.MethodInfo method, System.Boolean throwOnBindFailure) (at <cbc72d4a9767498db39486e941a498e3>:0)
System.Delegate.CreateDelegate (System.Type type, System.Reflection.MethodInfo method) (at <cbc72d4a9767498db39486e941a498e3>:0)
System.Reflection.RuntimeMethodInfo.CreateDelegate (System.Type delegateType) (at <cbc72d4a9767498db39486e941a498e3>:0)
ArgumentException: method arguments are incompatible
System.Delegate.CreateDelegate (System.Type type, System.Object firstArgument, System.Reflection.MethodInfo method, System.Boolean throwOnBindFailure, System.Boolean allowClosed) (at <cbc72d4a9767498db39486e941a498e3>:0)
System.Delegate.CreateDelegate (System.Type type, System.Reflection.MethodInfo method, System.Boolean throwOnBindFailure) (at <cbc72d4a9767498db39486e941a498e3>:0)
System.Delegate.CreateDelegate (System.Type type, System.Reflection.MethodInfo method) (at <cbc72d4a9767498db39486e941a498e3>:0)
System.Reflection.RuntimeMethodInfo.CreateDelegate (System.Type delegateType) (at <cbc72d4a9767498db39486e941a498e3>:0)
22 replies