Search Unity

Change Sprite Shown in Editor From Field

Discussion in 'Editor & General Support' started by alexander_q, Sep 9, 2014.

  1. alexander_q

    alexander_q

    Joined:
    Feb 7, 2014
    Posts:
    32
    I have some simple code wherein a dummy object instantiates something over the network.


    Code (CSharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4.  
    5. public class dummy_networkInstantiate : MonoBehaviour {
    6.  
    7.     public Object networkPrefab; //the thing to instantiate over the network
    8.  
    9.     void Start () {
    10.         Network.Instantiate(networkPrefab,transform.position,Quaternion.identity,0);
    11.         GameObject.Destroy(gameObject);
    12.     }
    13.  
    14. }
    15.  
    I want the sprite of the object IN THE EDITOR to change based on the object I add to "networkPrefab". This way, I could drag in a bunch of dummy objects into the scene, and assign what they should instantiate, and be able to see it reflected in the scene.

    How can I accomplish this?