Prefab Questions

Hey Justin,

My current workflow is assigning variables at runtime to prefabbed trees (each NPC has 4 trees Idle/Alert/Attack/Dead). This works fine, but I just started attempting to implement async additive loading. Assigning all the variables at runtime takes about 88ms for 10 NPCs which is far too much. Is there anyway to assign these variables at build time or in the editor? I attempted to create an editor script that exicuted the same code in editor from context menu but the variables don't persist (aren't serialized?)

Cheers,
Colton
 
Thanks for the reply Justin, I will look into the external tree, how do I download the RTS sample? I'm not certain this will solve the issue (as the time seems to be coming from passing variables into the trees which will have to happen anyways?) but I do think it is a better workflow.

I am currently assigning variables like this: behaviorTree.SetVariableValue("SightTransform", sightTransform);

Thanks again!
Colton
 
Oops, I missed your followup post.

how do I download the RTS sample?
You can download it on this page: https://opsive.com/downloads/?pid=803

I am currently assigning variables like this: behaviorTree.SetVariableValue("SightTransform", sightTransform);
Ah, ok, good, I got mixed up and thought that you are adding new variables, but you are just assigning. If the variable hasn't been assigned before then it will have to deserialize the tree, but other than that variable assignment is a O(1) method. It does sound like pooling the trees will save you some time.
 
Top