对了补充一下,地皮的贴图可以用_a贴图表现透明度。
然后导入游戏
记得开启modtool
同样的套用prop
选择模型
然后要输入代码,先注意一下几个参数,
var size = new Vector4(8,4,8,0),
两个8是生成地皮的大小,也就是说地皮本身的大小和你做模型的大小无关的。中间的4是游戏中上下高度的接受范围,地皮会显示在别的一些模型上面,但是如果模型和地皮的高度差超过这个范围会不显示或部分
var tiling = new Vector4(1,0,1,0);
这是平铺参数,表示整个地皮在范围内重复多少次
一般不会需要改
在最后 asset.m_UIPriority = 180; 这是一个优先级,会决定地皮在列表中的位置
设置好了之后,F7是modtool的代码窗开关,输入小框框里面


点击run就完事了
下面是完整代码,主要就注意第一个参数就行了
// this line defines the size of the prop. The mesh must have the same dimensions
var size = new Vector4(8,4,8,0);
// this defines the tiling factor in x and z direction
var tiling = new Vector4(1,0,1,0);
// do not change this section!
var asset = ToolsModifierControl.toolController.m_editPrefabInfo as PropInfo;
if(asset == null)
{
Debug.Log("Error: Not a prop!"); return;
}
var shader = Shader.Find("Custom/Props/Decal/Blend");
if(asset.m_material != null)
{
asset.m_material.SetOverrideTag("RenderType", "Decal");
asset.m_material.shader = shader;
asset.m_material.SetVector("_DecalSize", size);
asset.m_material.SetVector("_DecalTiling", tiling);
Debug.Log("Decal Shader applied!");
var marker = new Color(12f / 255, 34f / 255, 56f / 255, 1f);
var data1 = new Color(size.x / 255, size.y / 255, size.z / 255, 1f);
var data2 = new Color(tiling.x / 255, tiling.y / 255, tiling.z / 255, 1f);
asset.m_material.SetColor("_ColorV0", marker);
asset.m_material.SetColor("_ColorV1", data1);
asset.m_material.SetColor("_ColorV2", data2);
asset.m_material.SetColor("_ColorV3", Color.white);
Debug.Log("Decal Prop Fix mod data saved in asset!");
}
else
{
Debug.Log("Error: Decal has no texture!"); return;
}
if(asset.m_lodMaterial != null)
{
asset.m_lodMaterial.SetOverrideTag("RenderType", "Decal");
asset.m_lodMaterial.shader = shader;
asset.m_lodMaterial.SetVector("_DecalSize", size);
asset.m_lodMaterial.SetVector("_DecalTiling", tiling);
}
typeof(PropInfo).GetField("m_UIEditorCategory", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(asset, "PropsResidentialGroundTiles");
asset.m_createRuining = false;
asset.m_useColorVariations = false;
asset.m_requireHeightMap = true;
// change this value. It changes the order of props in the menu
asset.m_UIPriority = 180;
Debug.Log("Done!");