Fix crash when changing actor scene
This commit is contained in:
@@ -103,22 +103,28 @@ void Actor::SetSceneInHierarchy(Scene* scene)
|
|||||||
|
|
||||||
void Actor::OnEnableInHierarchy()
|
void Actor::OnEnableInHierarchy()
|
||||||
{
|
{
|
||||||
OnEnable();
|
if (IsActiveInHierarchy() && GetScene() && !_isEnabled)
|
||||||
|
|
||||||
for (int32 i = 0; i < Children.Count(); i++)
|
|
||||||
{
|
{
|
||||||
Children[i]->OnEnableInHierarchy();
|
OnEnable();
|
||||||
|
|
||||||
|
for (int32 i = 0; i < Children.Count(); i++)
|
||||||
|
{
|
||||||
|
Children[i]->OnEnableInHierarchy();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Actor::OnDisableInHierarchy()
|
void Actor::OnDisableInHierarchy()
|
||||||
{
|
{
|
||||||
for (int32 i = 0; i < Children.Count(); i++)
|
if (IsActiveInHierarchy() && GetScene() && _isEnabled)
|
||||||
{
|
{
|
||||||
Children[i]->OnDisableInHierarchy();
|
for (int32 i = 0; i < Children.Count(); i++)
|
||||||
}
|
{
|
||||||
|
Children[i]->OnDisableInHierarchy();
|
||||||
|
}
|
||||||
|
|
||||||
OnDisable();
|
OnDisable();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Actor::IsSubClassOf(const Actor* object, const MClass* klass)
|
bool Actor::IsSubClassOf(const Actor* object, const MClass* klass)
|
||||||
|
|||||||
Reference in New Issue
Block a user