diff --git a/source/components/assets.d b/source/components/assets.d index 7d9793a9..7fe17b99 100644 --- a/source/components/assets.d +++ b/source/components/assets.d @@ -141,7 +141,6 @@ public: foreach_reverse( index; 0 .. materials.length ) { auto name = materials.keys[ index ]; - materials[ name ].shutdown(); materials.remove( name ); } foreach_reverse( index; 0 .. animations.length ) diff --git a/source/components/material.d b/source/components/material.d index 5ff1e024..ff4949aa 100644 --- a/source/components/material.d +++ b/source/components/material.d @@ -11,7 +11,7 @@ import std.variant, std.conv, std.string; /** * A collection of textures that serve different purposes in the rendering pipeline. */ -shared final class Material : IComponent +shared final class Material { private: Texture _diffuse, _normal, _specular; @@ -56,11 +56,6 @@ public: return obj; } - - /// Empty method overload to make materials components. - override void update() { } - /// ditto - override void shutdown() { } } /** @@ -168,6 +163,6 @@ static this() IComponent.initializers[ "Material" ] = ( Node yml, shared GameObject obj ) { obj.material = Assets.get!Material( yml.get!string ); - return obj.material; + return null; }; } diff --git a/source/core/gameobject.d b/source/core/gameobject.d index a98f38c9..53aaaf55 100644 --- a/source/core/gameobject.d +++ b/source/core/gameobject.d @@ -273,7 +273,8 @@ public: */ final void addComponent( T )( shared T newComponent ) if( is( T : IComponent ) ) { - componentList[ typeid(T) ] = newComponent; + if( newComponent ) + componentList[ typeid(T) ] = newComponent; } /**