The Photon Forum
is Closed Permanently.

After many dedicated years of service, we have made the decision to retire our Forum and switch to read-only: we´ve saved the best to last! Your search result can be found below. Plus, we offer support via these channels:

Try Our

Please check if you can find an answer in our extensive documentation on PUN.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

NullReferenceException: Object reference not set to an instance of an object

2018-05-03 19:48:07

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

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;


## Comments

2018-05-03 19:51:47

Why does this not post the code in a formatted way? I used the <code="CodeInLine"> but it does not format it correctly. What is wrong with this website?

[Deleted User]
2018-05-08 08:14:19

Hi @RobertB,

do you have an actual reference to the attached PhotonView component? You can do this for example in the Awake or Start function by using photonView = GetComponent();.

Back to top