Hello,
I used to use the type UCesiumGltfComponent and the UCesiumGltfPrimitiveComponent with the declare:
#include “CesiumRuntime/Private/CesiumGltfComponent”
#include “CesiumRuntime/Private/CesiumGltfPrimitiveComponent”
I use them to obtain dynamic material instances to implement the function of changing the texture color at runtime.But when I update the plugin to the latest version,Compilation fails and show the error:
unresolved external symbol “private: static class UClass * __cdecl UCesiumGltfComponent::GetPrivateStaticClass(void)” (?GetPrivateStaticClass@UCesiumGltfComponent@@CAPEAVUClass@@XZ),function "private: void __cdecl AActor::ForEachComponent_Internal<class UCesiumGltfComponent,1,1,class <lambda_dd429f436a5209f3ea969caac49ede26> >(class TSubclassOf,class <lambda_dd429f436a5209f3ea969caac49ede26>)const " (??$ForEachComponent_Internal@VUCesiumGltfComponent@@$00$00V<lambda_dd429f436a5209f3ea969caac49ede26>@@@AActor@@AEBAXV?$TSubclassOf@VUActorComponent@@@@V<lambda_dd429f436a5209f3ea969caac49ede26>@@@Z)
How can I use the private class?Or there‘s other easier way to get the dynamic material instance and set it In the latest released version?
Hi @feiyifeng,
These types were not intended to be public, and it was only accidentally that they were accessible at all. I wonder if you might be able to accomplish your goal by using a Material Parameter Collection?
We’ve also considered providing other solutions, such as a callback that that can provide a dynamic material instance according to user-provided logic. We don’t have a specific timeline for that at the moment, though. Some more about that here (as well as more about use MPC):
I think you can probably even continue with your current approach without using the private Cesium types. CesiumGltfPrimitiveComponent is derived from UStaticMeshComponent, so you can cast to that instead and get the Material instance that way.
And finally, if all else fails, you’re always free to get the plugin source code and modify it to expose the private type again (remembering that we do not promise backward compatibility between versions when you use private types).
Kevin
Hi,
Thank you for your reply!!
I can’t use the the MPC because I need to make different tiles with same material become different color.
Then I tried another method you provided, using the USceneComponent and the UStaticMeshComponent instead of the UCesiumGltfComponent and the UCesiumGltfPrimitiveComponent ,and it works like it used to be! So thanks for helping me! Thank you very very much!!