Hello there,
I have followed the official documentation for creating components and getting them to display in the editor but I still can't see the component in the editor. I've created the component under 'Components/Character/CharacterMovement.hpp' and I have also added a 'CharacterMovement.json' file alongside it.
I have also registered the component in 'ComponentSystem.h' but the component still won't show in the editor:
#pragma once
#include "UltraEngine.h"
#include "Components/Character/CharacterMovement.hpp"
using namespace UltraEngine;
inline void RegisterComponents()
{
RegisterComponent<CharacterMovement>();
}
Here is 'CharacterMovement.hpp' file:
#pragma once
#include "UltraEngine.h"
using namespace UltraEngine;
class CharacterMovement : public Component
{
public:
CharacterMovement()
{
name = "CharacterMovement";
}
void Update() override
{
// ...
}
bool Load(table& properties, shared_ptr<Stream> binstream, shared_ptr<Map> scene, const LoadFlags flags) override
{
if (properties["m_WalkSpeed"].is_number())
{
m_WalkSpeed = properties["m_WalkSpeed"];
}
if (properties["m_SprintSpeed"].is_number())
{
m_SprintSpeed = properties["m_SprintSpeed"];
}
return true;
}
bool Save(table& properties, shared_ptr<Stream> binstream, shared_ptr<Map> scene, const SaveFlags flags) override
{
properties["m_WalkSpeed"] = m_WalkSpeed;
properties["m_SprintSpeed"] = m_SprintSpeed;
return true;
}
std::shared_ptr<Component> Copy() override
{
return std::make_shared<CharacterMovement>(*this);
}
public:
int m_WalkSpeed = 5.0f;
int m_SprintSpeed = 10.0f;
};
Here is the 'CharacterMovement.json' file:
{
"component": {
"properties": [
{
"name": "m_WalkSpeed",
"label": "Walk Speed",
"value": "5"
},
{
"name": "m_SprintSpeed",
"label": "Sprint Speed",
"value": "10"
}
]
}
}
I'm not sure what's happening here but if someone knows, I'd really appreciate the help!