Jump to content

[SOLVED] Writing messages to the console (Editor & in-game)


photo

Recommended Posts

Hi,

I'm trying to figure out how to write messages to both or either of the in game and IDE consoles, in C# components.

 

I've done this,

Unigine.Console.Run("show_messages 1");
		
Unigine.Log.Message("Begun title sequence./n");

 

And show_messages shows up in both consoles, however the following Log.Message, does not? 

 

Link to comment

This code should print messages:

  • In game console
  • In the IDE console (I used VS Code)
  • On the screen

It will print nothing in the Editor console since Editor can't run C# logic.

image.png

Here's the component:

using System;
using System.Collections;
using System.Collections.Generic;
using Unigine;

[Component(PropertyGuid = "69615053347c1996d89403fd993ef5380ccdb737")]
public class log : Component
{
	private void Init()
	{
		// write here code to be called on component initialization
		Unigine.Console.Run("show_messages 1");
	}
	
	private void Update()
	{
		// write here code to be called before updating each render frame
			
		Unigine.Log.Message("Begun title sequence.\n");
		
	}
}

Thanks!

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

Link to comment

Ah thank you I get what I did wrong I think. I was trying to send the message within the Init() function. I guess before the console was ready. Cheers.

  • Like 1
Link to comment
  • silent changed the title to [SOLVED] Writing messages to the console (Editor & in-game)
×
×
  • Create New...