Colludium
Your right. Unfortunatally. Your using a switch state system to create an object. However part of the problem with this design is variable association and large duplicatio of code. Since you can't reference the newly created object by it's Family UID until after the first tick. So
OnFunction.Create(TypeX)
if(param0)
Create ObjectTypeA
objectType.var1 = qwe
objectType.var2 = asd
objectType.var3 = zcv
objectType.var4 = tyu
objectType.var5 = ghj
if(param1)
Create ObjectTypeB
objectType.var1 = qwe
objectType.var2 = asd
objectType.var3 = zcv
objectType.var4 = tyu
objectType.var5 = ghj
if(param2)
Create ObjectTypeC
objectTypeC.var1 = qwe
objectTypeC.var2 = asd
objectTypeC.var3 = zcv
objectTypeC.var4 = tyu
objectTypeC.var5 = ghj
if(param3)
Create ObjectTypeD
objectTypeD.var1 = qwe
objectTypeD.var2 = asd
objectTypeD.var3 = zcv
objectTypeD.var4 = tyu
objectTypeD.var5 = ghj
Now imagine 20 of those. Possibly even with more customized paramater information. This is an attrocase horrible disgusting way to design a switch state creation. Why because you can't access the Family version of the object unteril after the first tick. And you might need to access by way of first tick. Instead a good design.
OnFunction.Create("type")
Family.Type = param0
System.Create(Family)
Family.var = qwer
Family.var = asd
.....
and that's it. That would have 20 family objects, 30 family objects. 1000 famiy objects... ok 1000 is far past excesive.
An alternative is to just make sure we can access the object by it's family ASAP rather than waiting a tick
OnFunction.Create("type")
if(param0 = type) Create Type....A
if(param0 = type) Create Type....B
if(param0 = type) Create Type....C
if(param0 = type) Create Type....D
if(param0 = type) Create Type....E
if(param0 = type) Create Type....F
if(param0 = type) Create Type....G
if(param0 = type) Create Type....H
... and then after alll those ifstatements
Family.var = qwer
Family.var = asd
.....
As it is. It kinda sucks for dynamic object creation. However there is a plugin to do what is requested. Also in the mean time. Just avoid this kind of object family creation.