bentaudun Posted August 28, 2020 Share Posted August 28, 2020 I am wondering if there is a possibility to view a real-time updated hierarchy of the world nodes. This is a feature that both Unity and Godot has, which is really useful. When adding nodes dynamically (with code), it is really nice to be able to pause the game and access game state during running. If this is not possible, what is your recommended workflow to look at game state, node hierarchy etc during run/debug? Link to comment
Amerio.Stephane Posted August 29, 2020 Share Posted August 29, 2020 You can use the Syncker plugin to show at run-time the objects hierarchy. Configure your project and add the Syncker plugin Add the line -extern_plugin "Syncker" to your run profile At run-time, press ESC to show the default app menu Select Plugins and enable Show debug window I'm not sure though if the Syncker plugin is part of the Community edition. Link to comment
bentaudun Posted August 30, 2020 Author Share Posted August 30, 2020 Hi and thank you for the suggestion. According to the documentation the Syncker plugin (https://developer.unigine.com/en/docs/2.12/code/cpp/plugins/syncker/) is not available for the Community version. Being used to Unity and the workflow there, I miss the possibility to look at a "real-time" updated hierarchy tree with node properties and also a scene view which is updated and can be freely navigated while "game" is running (or paused). Hopefully there is something similar that I have not found yet in Unigine Community version. Link to comment
morbid Posted September 1, 2020 Share Posted September 1, 2020 There's no ready tools for this. You can write your own. This sample shows how to build a hierarchy tree: treebox->setTexture("core/systems/syncker/gui/nodes_icons.png"); Unigine::Map<int, Unigine::NodePtr> item_to_node; Unigine::Map<Unigine::NodePtr, int> node_to_item; Vector<NodePtr> nodes; World::getNodes(nodes); for (int i = 0; i < nodes.size(); i++) { // add item int item = treebox->addItem(nodes[i]->getName(), nodes[i]->getType()); item_to_node.append(item, nodes[i]); node_to_item.append(nodes[i], item); if (!strcmp(nodes[i]->getName(), "")) treebox->setItemText(item, String::format("[%s_%d]", nodes[i]->getTypeName(), i).get()); // set color vec4 color = vec4(1, 1, 0, 1); color *= nodes[i]->isEnabled() ? 1.0f : 0.6f; treebox->setItemColor(item, color); } // hierarchy for (auto i = item_to_node.begin(); i != item_to_node.end(); i++) { NodePtr parent = i->data->getParent(); NodePtr possessor = i->data->getPossessor(); if (parent && node_to_item.contains(parent)) treebox->setItemParent(node_to_item[i->data], node_to_item[parent]); else if (possessor && node_to_item.contains(possessor)) treebox->setItemParent(node_to_item[i->data], node_to_item[possessor]); } Then you can create a widget to display the hierarchy. Thanks. How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
bentaudun Posted September 1, 2020 Author Share Posted September 1, 2020 Hi, thanks for the suggestion and code example, much appreciated! Link to comment
Recommended Posts