# SResource

**Membres** 7

|           |                                 |                                                                      |
| --------- | ------------------------------- | -------------------------------------------------------------------- |
| Propriété | [Name](#name)                   | Returns the name of the resource as entered in the scripting runtime |
| Propriété | [Type](#type)                   | Returns the type of the resource as a string                         |
| Propriété | [AsText](#astext)               | Converts the resource's type from SResource type to string           |
| Propriété | [AsGameObject](#asgameobject)   | –                                                                    |
| Propriété | [AsMaterial](#asmaterial)       | Converts the resource's type from SResource to SMaterial             |
| Propriété | [TextureWidth](#texturewidth)   | Returns the Texture Width of this resource                           |
| Propriété | [TextureHeight](#textureheight) | Returns the Texture Height of this resource                          |

## Propriétés

### Name

string Name {get; }

Returns the name of the resource as entered in the scripting runtime

Exemple

**Lua**

```lua
ResourceName = Space.Resources[1].Name

```

**Lua**

```lua
--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

```

### Type

string Type {get; }

Returns the type of the resource as a string

Exemple

**Lua**

```lua
ResourceType = Space.GetResource("Resource Name").Type

```

**Lua**

```lua
--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

```

### AsText

string AsText {get; }

Converts the resource's type from SResource type to string

Exemple

**Lua**

```lua
Text = Space.GetResource("Resource Name").AsText

```

### AsGameObject

[SGameObject](/docs/fr/scripting/client-scripting-api-reference/types/sgameobject.md) AsGameObject {get; }

Exemple

**Lua**

```lua
GameObject = Space.GetResource("Resource Name").AsGameObject

```

### AsMaterial

[SMaterial](/docs/fr/scripting/client-scripting-api-reference/types/smaterial.md) AsMaterial {get; }

Converts the resource's type from SResource to SMaterial

Exemple

**Lua**

```lua
Material = Space.GetResource("Resource Name").AsMaterial

```

### TextureWidth

float TextureWidth {get; }

Returns the Texture Width of this resource

Exemple

**Lua**

```lua
TextureWidth = Space.GetResource("Resource Name").TextureWidth

```

### TextureHeight

float TextureHeight {get; }

Returns the Texture Height of this resource

Exemple

**Lua**

```lua
TextureHeight = Space.GetResource("Resource Name").TextureHeight

```
