UnityEngine.Material.CopyPropertiesFromMaterial C# (CSharp) Method

CopyPropertiesFromMaterial() private method

private CopyPropertiesFromMaterial ( Material mat ) : void
mat Material
return void
        public extern void CopyPropertiesFromMaterial(Material mat);
        [Obsolete("Creating materials from shader source string will be removed in the future. Use Shader assets instead.")]

Usage Example

コード例 #1
0
ファイル: Building.cs プロジェクト: Kundara/project1
		// Use this for initialization
		void Start () {
			currentOutsideMaterial = new Material (dissolveMaterial.shader);
			currentOutsideMaterial.CopyPropertiesFromMaterial(dissolveMaterial);

			currentGlassMaterial = new Material (glassMaterial.shader);
			currentGlassMaterial.CopyPropertiesFromMaterial(glassMaterial);

			foreach (Transform t in outside.GetComponentsInChildren<Transform>()) {

				var renderer = t.gameObject.GetComponent<SpriteRenderer>();
				if (renderer != null) {
					
					if (t.CompareTag(Tags.Glass)){
						renderer.material = currentGlassMaterial;
					} else {
						renderer.material = currentOutsideMaterial;
					}


				}

		
			}

		}
All Usage Examples Of UnityEngine.Material::CopyPropertiesFromMaterial