- Newest
- Most votes
- Most comments
Yes, you should be able to use ComponentApplicationBus::Events::GetSerializeContext even while inside Game Mode.
Hi @REDACTEDUSER
Since you have ITreeGenerator and its derived classes hooked up to BehaviorContext, they should be registered with the RTTI system as well. In that case, you can use
AZ::IRttiHelper* derivedExternal = AZ::GetRttiHelper<DerivedExternal>();
// returns true if derived
derivedExternal->IsTypeOf(AZ::AzTypeInfo<ITreeGenerator>::Uuid());
To check each class. Let us know if that resolves your question.
Can you use RttiHelper with a uuid? Since I don't have type to use for AZ::GetRttiHelper<T>(), since I am just have the uuid of the class and BehaviorClass that BehaviorContext has
Yes, if you have access to the SerializeContext then you could get the ClassData for ITreeGenerator and call CanConvertFromType to check each uuid:
AZ::SerializeContext::ClassData* iTreeGeneratorClassData =
serializeContext->FindClassData(iTreeGeneratorUuid);
// returns true if derived
iTreeGeneratorClassData->CanConvertFromType(derivedUuid, serializeContext);
Or, you could access the ClassData for each potentially derived class, and get the IRttiHelper from there. Then you can use IsTypeOf method like so:
AZ::SerializeContext::ClassData* classData =
serializeContext->FindClassData(uuid);
AZ::IRttiHelper* derivedExternal = classData->m_azRtti;
// returns true if derived
derivedExternal->IsTypeOf(iTreeGeneratorUuid);
Well does the ComponentApplicationBus::Events::GetSerializeContext return the SerializeContext when the game is running, or is it just a editor thing?
Thanks. I figure out a better way to find the Derived class is using the EnumerateDerived method on SerializeConext and using the IObjectFactor create to create the object. I found this while trying to figure out how should I create a custom motion event and how EmotionFX added motion events to the add new event menu.
Nice, that's a creative solution! Thanks for sharing it with us. :)
This post is closed: Adding new answers, comments, and votes is disabled.
Relevant content
- asked a year ago
- asked a year ago
- AWS OFFICIALUpdated 9 months ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 6 months ago