---
title: "动态加载贴图和模型"
author: "Tecna"
date: "2011-09-23T14:49:25Z"
tags: []
categories: ["非技术"]
slug: "untitled"
draft: false
lastmod: "2011-09-23T14:49:25Z"
id: 1179021
url: "https://tecna.iteye.com/blog/1179021"
---

模型和贴图必需存在“Resources”文件夹下面

```
var mesh1 : GameObject;
function Start()
{
   mesh1 = Instantiate(Resources.Load("model"));                                                  //加载模型
   mesh1.transform.position=Vector3(1020,14,720);                                      //模型出现的位置
}
function Update () 
{
   renderer.material.mainTexture = Resources.Load("a");                                 //加载材质
}
```