You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
518 B

  1. using UnityEngine;
  2. public class ColourCollide : MonoBehaviour
  3. {
  4. public Texture newTexture;
  5. [SerializeField]
  6. [Tooltip("Layers to ignore when checking for blocks")]
  7. private LayerMask Ignore;
  8. public Block CurrentBlock;
  9. public Renderer abc;
  10. void Update()
  11. {
  12. Block.isBlockAtPosition(transform.position + Vector3.down / 2, 0.5f, ~Ignore, out CurrentBlock);
  13. abc = CurrentBlock.GetComponent<Renderer>();
  14. if(abc.material != newTexture){
  15. abc.material.SetTexture("_Albedo", newTexture);
  16. }
  17. }
  18. }