Jump to content

Unigine::text_base_error as default


photo
Go to solution Solved by silent,

Recommended Posts

Posted

Hi,

I don't know if it is an bug or an common scenario now, but creating ObjectText in version 2.18.1 will apply the Unigine::text_base_error as default to the object.

Simple code to reproduce:

Spoiler

Unigine::ObjectTextPtr text;

AppWorldLogic::AppWorldLogic()
{}

AppWorldLogic::~AppWorldLogic()
{}

int AppWorldLogic::init()
{
	// Create Object Text (created without a font or a text)
	text = Unigine::ObjectText::create();
	// Defining a text to write and a font
	text->setText("Debug");
	
    //applying the default material manually will avoid this and can be used as a workaround
    //Unigine::MaterialPtr mat = Unigine::Materials::findManualMaterial("Unigine::text_base");
	//text->setMaterial(mat,0);
	text->setFontName("font.ttf");
	text->setFontSize(100);
	text->setFontResolution(100);

	// Write here code to be called on world initialization: initialize resources for your world scene during the world start.
	return 1;
}

////////////////////////////////////////////////////////////////////////////////
// start of the main loop
////////////////////////////////////////////////////////////////////////////////

int AppWorldLogic::update()
{
	
	text->worldLookAt(Game::getPlayer()->getWorldPosition());
    text->rotate(270,0,180);
	// Write here code to be called before updating each render frame: specify all graphics-related functions you want to be called every frame while your application executes.
	return 1;
}


////////////////////////////////////////////////////////////////////////////////
// end of the main loop
////////////////////////////////////////////////////////////////////////////////

int AppWorldLogic::shutdown()
{
	text->deleteLater();

	// Write here code to be called on world shutdown: delete resources that were created during world script execution to avoid memory leaks.
	return 1;
}

 

 

Applying the default material manually to the ObjectText will fix this issue. Recompiling all shaders doesn't seem to help as well. We also didn't receive any error message.

 

Best

Christian

 

  • Solution
Posted

Hi Christian,

That's known issue for 2.18.1, you need to manually set material for ObjectText after creation. I think this was fixed in the 2.19.

Thanks!

  • Like 1

How to submit a good bug report
---
FTP server for test scenes and user uploads:

×
×
  • Create New...