Jump to content
firefall70

How to get a child entity from it's parent?

Recommended Posts

Hi,

I attached a child entity via the hierarchy to my parent entity. How can I access the child via script.
IEntity:GetChildren() only returns the first one, but I need a specific one.
IEntity:GetSibling() returns just null...

Share this post


Link to post
Share on other sites
array<IEntity> allChildren = new array<IEntity>();
IEntity specificChild;
IEntity child = GetChildren();		

 while (child)
{	
	if (condition)
  	{
  		specificChild = child;
  	}
  	
  	allChildren.Insert(child);
	child = child.GetSibling();
};

I think this should work, this will give you an Array of all children and a specific child.
I can't test it Right Now

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×