Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

在同一个GO下添加多个同类component #410

Open
rocketman123456 opened this issue Dec 24, 2022 · 2 comments
Open

在同一个GO下添加多个同类component #410

rocketman123456 opened this issue Dec 24, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@rocketman123456
Copy link
Contributor

在听完关于Lua Component的课程后,我尝试对同一个GO下挂载多个lua脚本,但是仅有的一个可以正常工作,是不是因为有这方面的限制?

@rocketman123456 rocketman123456 added the enhancement New feature or request label Dec 24, 2022
@rocketman123456
Copy link
Contributor Author

    bool GObject::hasComponent(const std::string& compenent_type_name) const
    {
        // FIXME : cannot create two component of same type
        for (const auto& component : m_components)
        {
            if (component.getTypeName() == compenent_type_name)
                return true;
        }

        return false;
    }

是这个代码的问题,导致不能创建两个相同类型的component。不知道有什么设计方案避免这个问题。

@liangzai12
Copy link
Contributor

是的,目前只支持挂载一个同类component

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants