Results 1 to 2 of 2

Thread: Assign new GUID immediatly when calling clone

  1. #1

    Lightbulb Assign new GUID immediatly when calling clone

    I'm handling objects with GUID, not reference (much simpler serialization). I'm cloning an element at some point in the game and I'm forced to use a Wait.frames(x, 2) to get its GUID.
    For some reason Wait.frames(x, 1) is not enough frames wasted...

    I don't want to have to do that and cloned object should have a different GUID immediatly, not on next frame, not 2 frames later.

  2. #2
    Join Date
    Sep 2017
    You have a trade-off between convenience of serialization and speed of operation. Most folks only serialize on load and save because it is expensive in processing time. The Wait.frames function counts frame boundaries, not a length of time. so Wait.frames(func() end, 1) can trigger immediately if you were at the end of the current frame. 2 is the minimum frame count that guarantees a delay, and you are "wasting" very little time; between 1 and 2/60ths. of a second. meanwhile all the other activities in the game and particularly after the Wait.frames() continue uninterrupted. If you want an actual in-line delay, that involves coroutines. search the scripting forum section for some detail on how to set that up.
    but back to the need for the delay: that is required by the UNITY engine on which tabletop simulator is built. It is not going to go away any time soon.

Similar Threads

  1. Calling LUTs from script
    By HourEleven in forum Scripting
    Replies: 0
    Last Post: 04-09-2020, 11:12 PM
  2. Calling All DMs!
    By Scoobs in forum Looking For Players
    Replies: 0
    Last Post: 11-17-2017, 10:34 AM
  3. Assign values to cards and sort them?
    By Raldor in forum Scripting
    Replies: 7
    Last Post: 05-13-2017, 05:52 PM
  4. Replies: 1
    Last Post: 07-14-2016, 08:17 PM
  5. [ADDED] Assign 'Value' to Custom Cards
    By 3volution in forum Suggestions
    Replies: 2
    Last Post: 04-16-2016, 05:52 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts