|
|
(7 intermediate revisions by 2 users not shown) |
Line 1: |
Line 1: |
− | The SHost class represents the scripting runtime.
| + | This page has moved to: https://docs.sine.space/v/scripting/client-scripting/scene/shost |
− | | + | |
− | ==Members==
| + | |
− | {{ScriptFunction|void|InvokeEvent|(string name);|Invokes a UnityEvent attached to the Scripting Runtime component this script is executing in.}}
| + | |
− | {{ScriptFunction|void|Stop|();|Pauses the current script until it is manually restarted, at the end of the current function/method; consider using return as well}}
| + | |
− | {{ScriptFunction|SGameObject|ExecutingObject|{ get; }|Returns the SGameObject this script is attached to}}
| + | |
− | {{ScriptFunction|string|Language|{ get; }|Returns the English name for the users language, e.g. 'English', 'French', 'Chinese'}}
| + | |
− | {{ScriptFunction|void|StartCoroutine|(DynValue func);|Executes the specified function as a coroutine.|
| + | |
− | local function myCoroutine()
| + | |
− | <br> -- The yield statement is a special kind of return, that ensures that the function will continue from the line once the coroutine resumes.
| + | |
− | <br> -- Placing a float value inside of the yield will result in a delayed execution.
| + | |
− | <br> -- Example: coroutine.yield(0.5) will wait 0.5 seconds before continuing the execution of the coroutine.
| + | |
− | <br>
| + | |
− | <br> -- This will print the current players active time.
| + | |
− | <br> Space.Log(Space.Time);
| + | |
− | <br>
| + | |
− | <br> -- Execution of this coroutine will be halted for 10 seconds.
| + | |
− | <br> coroutine.yield(10);
| + | |
− | <br>
| + | |
− | <br> -- This will print the current players active time, which will be 10 seconds greater then the previous as a result of the yield
| + | |
− | <br> Space.Log(Space.Time);
| + | |
− | <br>end
| + | |
− | <br>
| + | |
− | <br>Space.Host.StartCoroutine(myCoroutine);
| + | |
− | <br>
| + | |
− | }}
| + | |
− | {{Scripting Navbox}}
| + | |