Skip to content

Conversation

@ShinodaNaoki
Copy link

I made command support on WebGL build.

Ctrl+Alt+Click anywhere blank to open prompt and Input command. Then the result will be shown in browser console.
Thanks.

prompt1
commands

ShinodaNaoki and others added 3 commits February 12, 2018 21:44
I made command support on WebGL build.

Ctrl+Alt+Click anywhere blank to open prompt and Input command. Then the result will be shown in browser console.
/* Execute a command */
public static void Run(string str) {
#if UNITY_WEBGL && !UNITY_EDITOR
Instance.m_output.Clear();
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In WebGL mode, reset m_output for each command.


private static void LogCore(string str)
{
#if !UNITY_WEBGL || UNITY_EDITOR
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In WebGL mode, debug logs are already shown in browser console.
So I disable log callback to avoid duplicate output.

mainThread = Thread.CurrentThread;
fileRoot = Path.Combine(Application.streamingAssetsPath, "CUDLR");

#if !UNITY_WEBGL || UNITY_EDITOR
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I disabled them because we cant use socket in WebGL mode.


public static void Log(string text)
{
#if UNITY_WEBGL && !UNITY_EDITOR
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this method can show text on browser console, without using debug logger.

@@ -0,0 +1,37 @@
var CUDLR_Relay = {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is converted into javascript and placed on browser side.

return text;
}

document.onclick = function(){
Copy link
Author

@ShinodaNaoki ShinodaNaoki Feb 12, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

click on document with Shift and Alt key to open prompt.

SetCudlrCallbackAndCreateInput: function(callbackPtr){
cr_callback = callbackPtr;

window.cc = function(command) {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method invoke CUDLR.Console.Run() and output result on browser console.
You can also type like cc("object list") in the broser console command line to Run it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant