Expose Authoring Classes generated By GenerateAuthoringComponent Tag
DreamersIncStudios opened this issue · 0 comments
DreamersIncStudios commented
Need to get the following code working for easier SO spawning
internal static Type GetAuthoringComponentTypeFromIComponentData(Type IComponentDataType)
{
string[] AssemblyQualifiedNameAttributes = IComponentDataType.AssemblyQualifiedName.Split(',');
string AuthoringComponentAssemblyQualifiedName = $"{IComponentDataType.Name}Authoring";
for (int i =1;i< AssemblyQualifiedNameAttributes.Length;i++)
{
AuthoringComponentAssemblyQualifiedName = $"{AuthoringComponentAssemblyQualifiedName}, {AssemblyQualifiedNameAttributes[i]}";
}
Type AuthoringComponentType = Type.GetType(AuthoringComponentAssemblyQualifiedName);
AddComponentIfMissing(AuthoringComponentType);
return AuthoringComponentType;
}
GameObject gameObject = new GameObject();
gameObject.AddComponent(GetAuthoringComponentTypeFromIComponentData(typeof(IComponentData));