Fixed awake() and start() getting called before all objects are loaded when changing scenes #266
|
@ -219,10 +219,11 @@ namespace SHADE
|
|||
static void Exit() noexcept;
|
||||
|
||||
static std::string GetSceneName() noexcept;
|
||||
static void SetCurrentSceneName(std::string const& sceneName) noexcept;
|
||||
static AssetID GetCurrentSceneAssetID() noexcept;
|
||||
//Only if scene doesn't exist, and scene asset id needs to be updated to the new one
|
||||
static void SetCurrentSceneAssetID(AssetID const& newAssetID);
|
||||
static void SetCurrentSceneName(std::string const& sceneName) noexcept;
|
||||
static AssetID GetCurrentSceneAssetID() noexcept;
|
||||
//Only if scene doesn't exist, and scene asset id needs to be updated to the new one
|
||||
static void SetCurrentSceneAssetID(AssetID const& newAssetID);
|
||||
static bool HasSceneChanged() noexcept { return sceneChanged; }
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -74,8 +74,9 @@ namespace SHADE
|
|||
// Add the script in
|
||||
script->Initialize(GameObject(entity));
|
||||
entityScriptList->Insert(System::Math::Clamp(index, 0, entityScriptList->Count), script);
|
||||
if (Application::IsPlaying)
|
||||
if (Application::IsPlaying && !SHSceneManager::HasSceneChanged())
|
||||
{
|
||||
// Only call immediately if we are in game and is not loading another scene
|
||||
script->Awake();
|
||||
script->Start();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue