Skip to content

Instantly share code, notes, and snippets.

@ronyx69
ronyx69 / ShaderChange_Additive_Prop.cs
Last active April 6, 2018 09:04
Changes the shader of a prop to additive in asset editor.
var shader = Shader.Find("Custom/Particles/Additive (Soft)");
var asset = ToolsModifierControl.toolController.m_editPrefabInfo as PropInfo;
if(asset.m_material != null) asset.m_material.shader = shader;
if(asset.m_lodMaterial != null) asset.m_lodMaterial.shader = shader;
//scripts to use with the Realtime mod, filename must match file prefix in import folder
var type="building";
var filename="thing"; var assetname="thing";
Type.GetType("Realtime.RealtimeMod").GetMethod(type).Invoke(null, new object[] { filename, assetname });
var type="prop";
var filename="snow1"; var assetname="snow1";
Type.GetType("Realtime.RealtimeMod").GetMethod(type).Invoke(null, new object[] { filename, assetname });
@ronyx69
ronyx69 / UIPriority_AssetEditor.cs
Created May 8, 2018 22:25
Scripts for changing UI priority for the main prefab types. Determines item order in the menus.
// props
var asset = ToolsModifierControl.toolController.m_editPrefabInfo as PropInfo;
asset.m_UIPriority = 1;
// trees
var asset = ToolsModifierControl.toolController.m_editPrefabInfo as TreeInfo;
asset.m_UIPriority = 1;
// buildings
@ronyx69
ronyx69 / ShaderChange_Building_Floating.cs
Last active May 8, 2018 22:40
Change the shader of a building to Floating in asset editor.
var shader = Shader.Find("Custom/Buildings/Building/Floating");
var asset = ToolsModifierControl.toolController.m_editPrefabInfo as BuildingInfo;
if(asset.m_material != null) asset.m_material.shader = shader;
if(asset.m_lodMaterial != null) asset.m_lodMaterial.shader = shader;
@ronyx69
ronyx69 / ShaderChange_Building_Fence.cs
Last active May 9, 2018 16:49
Change the shader of a building to Fence in asset editor.
var shader = Shader.Find("Custom/Buildings/Building/Fence");
var asset = ToolsModifierControl.toolController.m_editPrefabInfo as BuildingInfo;
if(asset.m_material != null) asset.m_material.shader = shader;
if(asset.m_lodMaterial != null) asset.m_lodMaterial.shader = shader;
asset.m_requireHeightMap = true;
@ronyx69
ronyx69 / ShaderChange_Building_NoBase.cs
Last active May 14, 2018 14:20
Change the shader of a building to NoBase in asset editor.
var shader = Shader.Find("Custom/Buildings/Building/NoBase");
var asset = ToolsModifierControl.toolController.m_editPrefabInfo as BuildingInfo;
if(asset.m_material != null) asset.m_material.shader = shader;
if(asset.m_lodMaterial != null) asset.m_lodMaterial.shader = shader;
asset.m_requireHeightMap = false;
@ronyx69
ronyx69 / ShaderChange_Prop_Default.cs
Created May 16, 2018 14:13
Change the shader of a prop to Default in asset editor.
var shader = Shader.Find("Custom/Props/Prop/Default");
var asset = ToolsModifierControl.toolController.m_editPrefabInfo as PropInfo;
if(asset.m_material != null) asset.m_material.shader = shader;
if(asset.m_lodMaterial != null) asset.m_lodMaterial.shader = shader;
asset.m_requireHeightMap = false;
@ronyx69
ronyx69 / ShaderChange_Prop_Fence.cs
Created May 16, 2018 14:15
Change the shader of a prop to Fence in asset editor.
var shader = Shader.Find("Custom/Props/Prop/Fence");
var asset = ToolsModifierControl.toolController.m_editPrefabInfo as PropInfo;
if(asset.m_material != null) asset.m_material.shader = shader;
if(asset.m_lodMaterial != null) asset.m_lodMaterial.shader = shader;
asset.m_requireHeightMap = true;
@ronyx69
ronyx69 / TreeWindSway_AssetEditor.cs
Created May 17, 2018 18:35
Allows limiting wind sway effect for trees with an adjustable multiplier.
// Tree Wind Sway Recalculator
// Recalculates vertex colors based on the height.
// Allows limiting sway with an adjustable multiplier.
var sway = 0.69f; // Sway multiplier 0.0 (none) to 1.0 (max)
var asset = ToolsModifierControl.toolController.m_editPrefabInfo as TreeInfo;
Vector3[] vertices = asset.m_mesh.vertices; Color[] colors = new Color[vertices.Length];
for (int i = 0; i < vertices.Length; i++)
@ronyx69
ronyx69 / TreeWindSwayCentral_AssetEditor.cs
Last active May 20, 2018 10:22
Calculates custom center-outwards tree wind sway with an adjustable multiplier.
// Tree Wind Sway Recalculator (Central)
// Recalculates vertex colors based on the proximity to center.
// Allows limiting sway with an adjustable multiplier.
var sway = 0.2f; // Sway multiplier 0.0 (none) to 1.0 (max)
var bias = 1.6f; // "Contrast" between center and outer parts,
// increasing this will make the middle more static,
// and the outside move more.