0
function Start()
{
var linkedTerrain:Terrain = gameObject.GetComponent(Terrain);
_terrainGrid[0,0] = Terrain.CreateTerrainGameObject(linkedTerrain.terrainData).GetComponent(Terrain);
_terrainGrid[0,1] = Terrain.CreateTerrainGameObject(linkedTerrain.terrainData).GetComponent(Terrain);
_terrainGrid[0,2] = Terrain.CreateTerrainGameObject(linkedTerrain.terrainData).GetComponent(Terrain);
_terrainGrid[1,0] = Terrain.CreateTerrainGameObject(linkedTerrain.terrainData).GetComponent(Terrain);
_terrainGrid[1,1] = Terrain.CreateTerrainGameObject(linkedTerrain.terrainData).GetComponent(Terrain);
_terrainGrid[1,2] = Terrain.CreateTerrainGameObject(linkedTerrain.terrainData).GetComponent(Terrain);
_terrainGrid[2,0] = Terrain.CreateTerrainGameObject(linkedTerrain.terrainData).GetComponent(Terrain);
_terrainGrid[2,1] = Terrain.CreateTerrainGameObject(linkedTerrain.terrainData).GetComponent(Terrain);
_terrainGrid[2,2] = Terrain.CreateTerrainGameObject(linkedTerrain.terrainData).GetComponent(Terrain);
_terrainGrid[0,0].transform.constantForce = Vector3(0,0,1.0);
}
我在上面一行錯誤的錯誤:房產UnityEngine.Component.constantForce
只錯誤:屬性「UnityEngine.Component.constantForce」只有在統一的MonoDevelop讀
讀我想創建地形Materix和應用ConstantForce在他們身上,讓他們移動。我需要Materix,因爲我想重用它們並創建EndLess Envirnoment,讓它們移動。 我嘗試和遇到錯誤在這條線:
_terrainGrid[X,Y].transform.constantForce = Vector3(0,0,1.0);
錯誤:
Property 'UnityEngine.Component.constantForce' is read only