Well, after searching the Internet for this answer, I can not figure out how this is happening. I have seen forums discussing that you need to Instantiate the object, but I can not get my head wrapped around what the code needs to look like.
The idea is this: The player wants to launch a UAV (drone), and see the camera, that is on the drone, displayed on the monitor he is looking at, on the table, so that he can fly the drone around...
This is what I have at this point
![]()
The idea is this: The player wants to launch a UAV (drone), and see the camera, that is on the drone, displayed on the monitor he is looking at, on the table, so that he can fly the drone around...
This is what I have at this point

<br />
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DroneMonitor_Trigger_Script : Photon.MonoBehaviour
{
public GameObject Drone;
public float Speed;
public bool HaveWeEnteredTrigger = false;
public Vector3 dir;
//=========================================================================
[PunRPC]
public void MoveDrone(Vector3 direction)
{
Drone.transform.Translate(Vector3.up * Time.deltaTime * Speed);
}
//=========================================================================
public void OnTriggerEnter(Collider other)
{
if(other.tag == "Player")
{
HaveWeEnteredTrigger = true;
}
}
//=========================================================================
// Update is called once per frame
void Update ()
{
if (Input.GetKey(KeyCode.Insert))
{
if (HaveWeEnteredTrigger == true)
{
dir = Vector3.up;
photonView.RPC("MoveDrone", PhotonTargets.MasterClient, dir);
// The above line is what is generating the error...
// NULLREFERENCEEXCEPTION: Object reference not set to an instance of an object.
// DroneMonitor_Trigger_Script.Update() (at Assets/DroneMonitor_Trigger_Script.cs:39)
}
}
<img src="http://www.carpatheous.com/DroneWithCamera.png" alt="" />
}
}