Jump to content

[SOLVED] Can't create a Component - No appropriate default constructor available


photo

Recommended Posts

Hello!
I'm trying to create a component in C++ by inheriting from ComponentBase, but when I compile I get "no appropriate default constructor available". I'm confused because all the example components have no constructors. Am I doing something wrong?

This is my code:

CarPhysicsWorld.h:

#pragma once

#include <UnigineGame.h>
#include <UnigineComponentSystem.h>

class  CarPhysicsWorld : public Unigine::ComponentBase
{
public:
	COMPONENT(CarPhysicsWorld, Unigine::ComponentBase)
	COMPONENT_INIT(Init)
	COMPONENT_UPDATE(Update)
	PROP_PARAM(Float, Gravity, -9.81)

protected:
	void Init();
	void Update();	
};

CarPhysicsWorld.cpp:

#include "CarPhysicsWorld.h"
#include <UnigineGame.h>
#include <UnigineWorld.h>
  
REGISTER_COMPONENT(CarPhysicsWorld)

using namespace Unigine;
using namespace Math;

void CarPhysicsWorld::Init()
{	
}

void CarPhysicsWorld::Update()
{
}


 

Link to comment

Got it working. I had to create a new project though but code is the same. Upgrading it from 2.15 to 2.15.1 may have broken something in my project, not 100% sure.

Link to comment
  • silent changed the title to [SOLVED] Can't create a Component - No appropriate default constructor available
×
×
  • Create New...