Hi again,
so I ran into another problem with my characters. I want to spawn random templates of characters so that when there are more people in the same ‘room’ of the server, they don’t have the same characer.
This works until I have to assig the animations to the blendtree by script.
I need to call them by the CharacterName + animation name to stay flexible with all the characters.
But that only works with one Character (Ch07) and not the other one(s) since all of the others names are ‘RootNode’ when logging this.entity.name.
I tried reimporting and stuff, but that didn’t fix it.
Do you have any suggestions what else I can try?
Hi @yaustar,
what I need is the name of the instanced Template which should be the same as in the editor, so that I can assign the correct animations to the blend tree.
The animations are named like Ch07_Walking, so in code i search for the name of the character (Ch07) with entity.name, and add a ‘_walking’ to that.
This works for the one character but not for the ch12 since its ‘name’ in the console is somehow RootNode.
Strange thing is that when I manually drag this character into the scene, the attached script logs (in the instanciate) the correct entity.name (ch12) and not RootNode.
So what I was wondering, where does this entityName ‘Rootnode’ come from? nothing in my character template is named like that.
What I also noticed is that the children of the character that logs ‘Rootnode’ are named correctly like they are in editor.
Ah yes sorry, I forgot to mention that you should open 2 Tabs since you can only see the ‘other persons’ in that room but not yourself.
In the blendtree script in the Initialize, I log the name of the entity. And I think the error with the loadStateGraph logs because it doesnt find all the animations?
It looks like when Ch12 template was created, it was when the top most node was named RootNode. The way that the engine instances the template is different to the editor where in the Editor, the asset name is used.
This doesn’t seem to be the case with the engine method. (Not sure if bug or as designed @mvaligursky ?)
To fix this, I created a new template from an instance of Ch12 so that it is created with the top most node being the correct name of Ch12.
As another note, anim state names cannot have a . in them. That causes bugs which I thought we fixed. I will create tickets for this issue
I seems the root node of the GLB is called “RootNode” - so that is the name that is left on the entity when the glb is instantiated … we don’t rename it at all.
This issue was driving me insane. This seems like a pretty straightforward bug.
When a template asset is spawned, it uses the name it was created with, not its actual current name. The workaround is to put a template in the scene, unlink the scene template from the base template, delete the base template, and then create a new template using the entity in the scene. This must be done whenever you change the name of a template (if you need to reference a template/spawned entity by name at runtime).
Eta: It concerns me that my template is being spawned with information I cannot directly see or control. It makes me wonder what other information is not being updated when I update it?