Quantcast
Channel: Latest Questions on Unity Answers
Viewing all articles
Browse latest Browse all 171066

How Do I access a Variable from One Script in another script?

$
0
0
In a C# script i tried this First file: class Ada{ int n; } Another file: class Bada{ Ada myAda; void start(){ myAda = new Ada(); myAda.n = 3; } } ANDDD IT didn't work. I got error like "You are trying to create a MonoBehaviour using the NEW keyword. This is not allowed" So then, how do i access those variables?

Viewing all articles
Browse latest Browse all 171066

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>