- Home /
Question by
wedermarco · Aug 03, 2020 at 10:54 PM ·
c#objectunityeditorreferencestatic
Do you have to set a object reference for every script?
Hello, I was wondering if I have to set an object reference for every single script I'm using a method from in another script. My projects starts getting a bit complex and the start of every script looks like:
public Settings Settings;
public Webcam Webcam;
public CubeTracking CubeTracking;
public ColorDetection ColorDetection;
public SquareFrame SquareFrame;
public ArrowFrame ArrowFrame;
public Rotation Rotation;
public Handle3DCube Handle3DCube;
public Rotate3DCube Rotate3DCube;
This is just one example and all this classes are used in this script so I set an object reference to all of them. Isn't there a simpler way to do this? I heard of static classes but I'm not sure if that's the right way to go.
Thanks in advance :)
Comment
Your answer
Follow this Question
Related Questions
C# Null Object Reference - Driving me mad! 1 Answer
Distribute terrain in zones 3 Answers
C# transfer reference of object 2 Answers
pre generated static Object in C# 1 Answer