Index: source/simulation2/components/CCmpVisualActor.cpp =================================================================== --- source/simulation2/components/CCmpVisualActor.cpp +++ source/simulation2/components/CCmpVisualActor.cpp @@ -68,6 +68,8 @@ private: std::wstring m_BaseActorName, m_ActorName; bool m_IsFoundationActor; + + // Not initialized in non-visual mode CUnit* m_Unit; fixed m_R, m_G, m_B; // shading color @@ -450,13 +452,13 @@ SetVariant("animation", m_AnimName); + CmpPtr cmpSound(GetEntityHandle()); + if (cmpSound) + m_SoundGroup = cmpSound->GetSoundGroup(wstring_from_utf8(m_AnimName)); + if (!m_Unit || !m_Unit->GetAnimation() || !m_Unit->GetID()) return; - CmpPtr cmpSound(GetSimContext(), m_Unit->GetID()); - if (cmpSound) - m_SoundGroup = cmpSound->GetSoundGroup(wstring_from_utf8(m_AnimName)); - m_Unit->GetAnimation()->SetAnimationState(m_AnimName, m_AnimOnce, m_AnimSpeed.ToFloat(), m_AnimDesync.ToFloat(), m_SoundGroup.c_str()); }