Jump to content

Search the Community

Showing results for tags 'classes'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to UNIGINE Forums
    • News & Announcements
    • Getting started
  • Development
    • Content Creation
    • World Design
    • Rendering
    • Animation
    • Physics, Navigation and Path Finding
    • UI Systems
    • Sound & Video
    • Editor
    • C++ Programming
    • C# Programming
    • Networking
    • Sim IG (Image Generator)
    • VR Discussions
    • General
  • Improving UNIGINE
    • Documentation
    • Feedback for UNIGINE team
    • Bug Reports
    • Unigine SDK Beta feedback
  • Community
    • Add-on Store (https://store.unigine.com/)
    • Showcase
    • Collaboration
    • Tools, Plugins, Materials & Tutorials
    • General Discussions
  • Legacy
    • UnigineScript

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Found 2 results

  1. Threads and memory in classes

    Hi. I have to do a job in a class in a thread. But it seems that threads and classes do not play well. Specifically the class that carries out the action "do_blocking()" in the example below is created as uninitialised as if it is a completely new class TestClass { int canary; TestClass() { canary = 1; } void do_async() { log.message("TI: %s\n", typeinfo(this)); log.message("Canary value = [%d]\n",canary); thread("do_blocking"); } void do_blocking() { log.message("TI: %s\n", typeinfo(this)); log.message("Canary value = [%d]\n",canary); } }; The output from running "TestClass tc = new TestClass(); tc.do_async()" is 16:29:29 TI: TestClass 0000000007EB7150 (196608:0:0) 16:29:29 Canary value = [1] 16:29:29 TI: TestClass 0000000000000000 (196608:-1:-1) 16:29:29 Canary value = [0] What I desire is that it is possible to launch a thread in a class and have that thread operate on the same object that spawned it, but it does not seem to be the case here. Am I missing something simple?
  2. Hello ! I am currently seeking for a scripting functionality that I can't really find. Problem: I would like to share a user class across each World scripts. This class could handle and save some attributes for example (it is like some kind of "singleton" pattern). According to the documentation, I have foundb(from https://developer.un...stem.get_string) : variable engine.system.get(string var) Description Returns a variable from the system script. Instances of user-defined classes cannot be requested in such a manner. Arguments string var - Variable name with a namespace, if needed. Return value Requested instance. As you could read : Instances of user-defined classes cannot be requested in such a manner And it is true, trying to share user class in such a manner lead to Unigine crash. Could you please give me some tips on how to achieve that kind of task ? (I believe I could write my own C++ plug-in that will expose my user class to Unigine script and ensure "singleton" pattern but I think it is a bit too "complicated" only for that) Thanks for reading me !
×
×
  • Create New...