Hi, Justin,
I'm running into a trouble adding my own custom type.
I'm trying to extend a class, for example, ShootableWeapon.cs and add a public custom type, Dictionary in this case, but it won't work.
First of all, I don't want to modify Opsive code directly so that I don't have to do a manual merge everytime I update.
1. Could you please explain how I can add a Dictionary type and make it inspectable? It seems like, in order to display any custom type, I have to add the type to ObjectInspector.cs or something. Is there a way I can add my custom type without touching Opsive file?
1.1 I think the best solution is to make the inspector to display custom type automatically without doing anything, but I'm not sure if you try to do that. One way that I know is to use Odin. I use Odin and Odin has a nice serializer that seems to work for any custom type without any fuss, including Dictionary, however, Odin serializer is not compatible with UCC. It conflicts with UCC and not sure how to replace UCC serializer with Odin's The good news is that Odin provides an open source version of their serializer (https://github.com/TeamSirenix/odin-serializer) and I think it will worth your time to take a look so that adding a custom type will not require any additional work from users, you included. ^^. It's looks really nice if you haven't seen them and it can save you lots of time. I think I heard about that they are even providing a redistributable version of their commercial version. It won't hurt to ask them if you are interested. In the meantime, I wish I could know I to replace UCC serializer with Odin. It will solve my problem until then. ^^
2. I extended a Opsive class and added several primitive property types. And then I created a EditorInspector class on the extended class so that the inspector will display Opsive class in nice format however, my added properties will not show up unless I explicitly list them in GetDrawCallback. Is there a way to display them in the inspector without the explicit listing? It seems like quite a lot of work to maintain both Engine class and Inspector class.
Thanks a lot!
Cheers
I'm running into a trouble adding my own custom type.
I'm trying to extend a class, for example, ShootableWeapon.cs and add a public custom type, Dictionary in this case, but it won't work.
First of all, I don't want to modify Opsive code directly so that I don't have to do a manual merge everytime I update.
1. Could you please explain how I can add a Dictionary type and make it inspectable? It seems like, in order to display any custom type, I have to add the type to ObjectInspector.cs or something. Is there a way I can add my custom type without touching Opsive file?
1.1 I think the best solution is to make the inspector to display custom type automatically without doing anything, but I'm not sure if you try to do that. One way that I know is to use Odin. I use Odin and Odin has a nice serializer that seems to work for any custom type without any fuss, including Dictionary, however, Odin serializer is not compatible with UCC. It conflicts with UCC and not sure how to replace UCC serializer with Odin's The good news is that Odin provides an open source version of their serializer (https://github.com/TeamSirenix/odin-serializer) and I think it will worth your time to take a look so that adding a custom type will not require any additional work from users, you included. ^^. It's looks really nice if you haven't seen them and it can save you lots of time. I think I heard about that they are even providing a redistributable version of their commercial version. It won't hurt to ask them if you are interested. In the meantime, I wish I could know I to replace UCC serializer with Odin. It will solve my problem until then. ^^
2. I extended a Opsive class and added several primitive property types. And then I created a EditorInspector class on the extended class so that the inspector will display Opsive class in nice format however, my added properties will not show up unless I explicitly list them in GetDrawCallback. Is there a way to display them in the inspector without the explicit listing? It seems like quite a lot of work to maintain both Engine class and Inspector class.
Thanks a lot!
Cheers