mirror of
https://github.com/4ian/GDevelop.git
synced 2025-10-15 10:19:04 +00:00
Merge pull request #133 from victorlevasseur/bugfix/platform-invalid-objects
Fix Project::CreateObject not properly creating objects when multiple platforms are available
This commit is contained in:
@@ -109,8 +109,8 @@ std::shared_ptr<gd::Object> Project::CreateObject(const std::string & type, cons
|
||||
{
|
||||
if ( !platformName.empty() && platforms[i]->GetName() != platformName ) continue;
|
||||
|
||||
std::shared_ptr<gd::Object> object = platforms[i]->CreateObject(type, name);
|
||||
if ( object ) return object;
|
||||
std::shared_ptr<gd::Object> object = platforms[i]->CreateObject(type, name); //Create a base object if the type can't be found in the platform
|
||||
if ( object && object->GetType() == type ) return object; //If the object is valid and has the good type (not a base object), return it
|
||||
}
|
||||
|
||||
return std::shared_ptr<gd::Object>();
|
||||
|
Reference in New Issue
Block a user