URHO3D_OBJECT: Function definition not found

Currently trying to make a LogicComponent but it doesn’t seem to be working. In the logs when I create it it gives me

ERROR: Could not create unknown component type 383225A1

The header and source for it is basic enough and seems fine to me

class Player : public LogicComponent {
URHO3D_OBJECT(Player, ur::LogicComponent);

	Player(ur::Context *context);
	static void RegisterObject(ur::Context *context);
	virtual void Start();
	virtual void FixedUpdate(float deltaTime);



#include "Player.hpp"
Player::Player(ur::Context *context) : ur::LogicComponent(context) {

void Player::RegisterObject(ur::Context *context) {


void Player::Start() {


void Player::FixedUpdate(float deltaTime) {


What’s causing it I believe is URHO3D_OBJECT, let me link what it’s complaining about: http://prntscr.com/fqf2vo
Quite strange. :thinking:
Has anyone else encountered this happening before and found any solutions?

So, you should register your component factory in RegisterObject, for example:

context->RegisterFactory <Player> (/*component category*/);

And then, you should call this static function on application startup.
Also, in this function you should register object attributes (if you need it, of course). Attributes can be automatically serialized and replicated over network. Attribute registration example:

URHO3D_MIXED_ACCESSOR_ATTRIBUTE ("War Hash", GetWarHash, SetWarHash, Urho3D::StringHash, Urho3D::StringHash::ZERO, Urho3D::AM_DEFAULT);

PS. Don’t write namespace names to URHO3D_OBJECT macro. So it should look like:

URHO3D_OBJECT(Player, LogicComponent)
1 Like

move context->RegisterFactory(); to RegisterObject() and call before using class

1 Like

Aha! It works fine now! :slight_smile:
I guess I didn’t look over the AnimatedScene example thoroughly