|
|
Line 1: |
Line 1: |
− | =Public Attributes=
| + | This page has moved to: https://docs.sine.space/v/scripting/client-scripting/types/sresource |
− | {{ScriptFunction|string|Name|{ get;}|Returns the name of the resource as entered in the scripting runtime|5= <pre>ResourceName = Space.Resources[1].Name</pre>|6=<pre>--the below script will search through the Scripting Runtime's resources
| + | |
− | --and return the first instance of an Animation Clip
| + | |
− | --[You need to add a few resources to the scripting runtime and make one of them an animation]
| + | |
− | | + | |
− | | + | |
− | resources = Space.Resources
| + | |
− | | + | |
− | for i = 1, #resources do
| + | |
− | if resources[i].Type == "AnimationClip" then
| + | |
− | Space.Log("Resource #".. i .. " is an Animation Clip. The resource name is: " .. resources[i].Name)
| + | |
− | break
| + | |
− | end
| + | |
− | end</pre>}}
| + | |
− | | + | |
− | | + | |
− | =Properties=
| + | |
− | | + | |
− | | + | |
− | {{ScriptFunction|string|Type|{ get;}|Returns the type of the resource as a string|5= <pre>ResourceType = Space.GetResource("Resource Name").Type</pre>|6=<pre>--the below script will search through the Scripting Runtime's resources
| + | |
− | --and return the first instance of an Animation Clip
| + | |
− | --[You need to add a few resources to the scripting runtime and make one of them an animation]
| + | |
− | | + | |
− | | + | |
− | resources = Space.Resources
| + | |
− | | + | |
− | for i = 1, #resources do
| + | |
− | if resources[i].Type == "AnimationClip" then
| + | |
− | Space.Log("Resource #".. i .. " is an Animation Clip. The resource name is: " .. resources[i].Name)
| + | |
− | break
| + | |
− | end
| + | |
− | end</pre>}}
| + | |
− | | + | |
− | | + | |
− | {{ScriptFunction|string|AsText|{ get; }|Converts the resource's type from SResource type to string |5= <pre>Text = Space.GetResource("Resource Name").AsText</pre>|6=<pre></pre>}}
| + | |
− | | + | |
− | | + | |
− | {{ScriptFunction|SGameObject|AsGameObject|{ get;}||Converts the resource's type from SResource to SGameObject|5= <pre>GameObject = Space.GetResource("Resource Name").AsGameObject</pre>|6=<pre></pre>}}
| + | |
− | | + | |
− | | + | |
− | {{ScriptFunction|SMaterial|AsMaterial|{ get; }|Converts the resource's type from SResource to SMaterial|5= <pre>Material = Space.GetResource("Resource Name").AsMaterial</pre>|6=<pre></pre>}}
| + | |
− | | + | |
− | | + | |
− | {{ScriptFunction|float|TextureWidth|{ get; }|Returns the Texture Width of this resource|5= <pre>TextureWidth = Space.GetResource("Resource Name").TextureWidth</pre>|6=<pre></pre>}}
| + | |
− | | + | |
− | | + | |
− | {{ScriptFunction|float|TextureHeight|{ get; }|Returns the Texture Height of this resource|5= <pre>TextureHeight = Space.GetResource("Resource Name").TextureHeight</pre>|6=<pre></pre>}}
| + | |
− | | + | |
− | | + | |
− | | + | |
− | {{Scripting Navbox}}
| + | |