将其中一个剪切图像指定给精灵渲染器

时间:2015-09-08 13:21:33

标签: c# unity3d sprite-sheet

我想将图像分配给精灵渲染器组件

但它不是单个图像,而是来自使用精灵编辑器的剪切图像

检查此图片以获取它:http://i.imgur.com/HhRjBgp.jpg

1 个答案:

答案 0 :(得分:0)

您可以使用Resources.LoadAll从单个切片精灵中获取精灵数组。

部分示例

    Private Sub Example(panposition As Integer)

    Dim tbfile = New TextBox()
    Dim lineExample As Integer = 2
    ' creating a text box with a variable name
    Controls.Add(tbfile)                    ' create the new textbox to hold the file name
    tbfile.Name = "tbfile" + panposition.ToString
    tbfile.Location = New Point(85, tvposition)
    tbfile.Size = New Size(155, 20)
    tbfile.Text = "file name"
    tbfile.TextAlign = HorizontalAlignment.Left
    tbfile.HideSelection = False
    tbfile.TabStop = False
    tbfile.AllowDrop = False
    tbfile.Visible = True

    ' trying to update the text in the text box using file name and text retrieved from an array
    Me.Controls.(arrTextVals(1, lineExample)).Text = arrTextVals(2, lineExample)


End Sub