Advertisement
clear_code

ObjectReplacer

Feb 25th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.73 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class ReplaceObjectOnClickClass : MonoBehaviour
  5. {
  6.     delegate void ReplaceObject();
  7.     ReplaceObject myReplaceObject;
  8.    
  9.  
  10.     void Start ()
  11.     {
  12.         myReplaceObject += ReplaceObjectWithSelected;
  13.         myReplaceObject += TurnRed;
  14.        
  15.         if(myReplaceObject != null)
  16.         {
  17.             myReplaceObject();
  18.         }
  19.     }
  20.    
  21.     void ReplaceObjectWithSelected()
  22.     {
  23.         - get original object transform
  24.         - get new object
  25.         - set new object with orginanl trasform
  26.    
  27.         print ("Successfully replaced object!");
  28.     }
  29.    
  30.     void ReplaceObjectHighlighter()
  31.     {
  32.         renderer.material.color = Color.red;
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement