LoopScrollRect icon indicating copy to clipboard operation
LoopScrollRect copied to clipboard

Inherit from ScrollRect, but use reflection; to make code more maintainable?

Open roointan opened this issue 2 years ago • 1 comments

In the descriptions, you've said "I need to modify some private variants to make dragging smooth." But I think it's possible to do that using reflection. This removes code duplication, won't need copying a newer ScrollRect code if one becomes available, and makes understanding the additional features easier (since we won't need to study the duplicated codes). Is there anything else that stopped you from inheritance, besides access to private members? If that's the only reason, I could try, and see if inheritance + reflection works.

roointan avatar May 18 '23 02:05 roointan

Yep, overriding/modifying private methods/members is the only reason for copying codes. If reflection works and performance doesn't hurt, it would be great! ps. I tried long time ago but fails with IL2CPP. I'm not sure if it works with recent Unity.

qiankanglai avatar May 18 '23 12:05 qiankanglai