Sign in to follow this  
_Q_

Find entity by name?

Recommended Posts

Serpens    570

I don't know such a way.
But you can first search by tag and then sort them by prefab.
So to get eg. rabbit you can first search for "animal" and then loop thorugh the results and check the prefab.

Share this post


Link to post
Share on other sites
Aquaterion    821

if you mean names like pignames and what not, there might be a tag for entities with the named component. If there is, I think the tag would be "_named".

Share this post


Link to post
Share on other sites
_Q_    644

I search by tag and then need to compare the string provided as function argument with name of the prefab.

Not sure if entity:GetBasicDisplayName() is the right fucntion, it will return the string name, i dont rember if there was something like prefab.name in there somwhere.

Share this post


Link to post
Share on other sites
Serpens    570
24 minutes ago, _Q_ said:

I search by tag and then need to compare the string provided as function argument with name of the prefab.

Not sure if entity:GetBasicDisplayName() is the right fucntion, it will return the string name, i dont rember if there was something like prefab.name in there somwhere.

what exactly do you want to find? Please give an example.
Do you want to get the prefab? Or the string name? or the name like "steve" given from the "named" component ?

You get the string name by:
GLOBAL.STRINGS.NAMES[string.upper(prefab)]

Share this post


Link to post
Share on other sites
CarlZalph    5277

You question is quite vague as to what you're wanting.

 

inst.name

inst.prefab

inst:GetBasicDisplayName()

inst:GetDisplayName()

 

TheSim:FindEntities only filters by tags, but during your iteration loop on it you can compare against these for further filtering.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this