Accessing scripts between GameObjects

I would have to say the previous 3 posts are totally useless in the context of this convsersation. WHO CARES!

Look, if you guys are interested in it, it’s not a hard task, but you will find out pretty quick that the scripting reference states every bit of what you are discussing.

Look at the overridable functions. This is everything you can put in a MonoBehaviour and have it run automatically. Not everything there runs the same in all situations. Some have to have a camera, some a collider/rigidbody, lights or whatever. Rewriting the reference is not the answer here though.

The OP asked specifically about interaction between scripts. I agree with the answer, but offer that is not the only way you can push data around. We are forgetting the SendMessage methods. Probably even more. Trying to get this all into one convenient document would totally be futile as it would have to be then updated with any changes in the next release of Unity.

So for gods sake Quietus and Dissidently quit squabbling. It is not helping either of your causes, and certainly not helping anyone figure out what the OP originally posted, or how to do it.

I’ll write something in my spare time, no promises when it’ll be released though.

It doesn’t seem to matter how many times or ways I try to express what I’m on about, each time you, and those of your ilk, will see it as the analogy you’ve described. That’s part my fault for not finding a way to express myself in a way that you understand. It’s partially your fault, since you seem to have made no effort at all, with the exception of throwing lame barbs, to understand what I’m on about.

Sticking to failed analogies:

Imagine Adobe not teaching their layer methodology in Photoshop thoroughly, nor explaining the timeline in Flash until its nested relationships with Symbols was buried into the users heads.

Imagine Autodesk not explaining/basing their education around understanding and implementing the modifier stack in all the users workflow and creation techniques.

The communication between scripts and objects/components/functions/variables relative to the update functions IS the modifier stack of Unity. It’s the best reason to choose Unity over any other engine, because of the flex it provides in approaches, design flex, iteration flex, idea testing flex etc etc…

Imagine trying to give your neighbour a cow to eat his overgrown grass, without telling him she makes milk. Your neighbour is going to say “thanks, but no, that’s a slow way to cut grass…” and go buy a lawn mower.

Imagine that they have documented those things, along with the existence of a plethora of tutorials, videos, forum posts and other examples. Now imagine there is someone who logs onto the Adobe forums and posts a series of TLDR over the top rants that the documentation on Photoshop is insufficient because it doesn’t teach him how to use a mouse and GUI using pictures and diagrams.

Yes it’s very important, and that is why it is extremely well documented.

You just can’t come to grips with the fact that your previous posts such as “I suck at maths” and “what does mono mean?” and the skillset they represent might have far more to do with your hurdles of understanding the basics than the quality of Unity’s documentation. You are taking your own deficiencies and projecting them instead of trying to rectify the problem. Once again, it’s not Unity’s job to teach you how to program.

If you go read any of the “Why choose Unity” threads over the years, you will find that often the high quality of Unity’s documentation is given top billing. This includes the thread you started where you were trolling Unity’s marketing.

@ dissidently

Here a just a few things to consider.

  1. Unity is one of the, if not the, easiest to use game engines - especially from a programmer POV.

  2. There are at least half a dozen excellent Video Tutorial SERIES on how to use unity, dozen’s of free example projects, 4 + 1 BOOKS, an active forum,. unity answers, excellent documentation with EXAMPLES for almost everything, wiki etc.

  3. Developers, specially programmers, love it.

  4. While a excellent candidate platform to teach programming (people do learn using unity), it is actually a tool and one should know how to program before using it.

Whether or not you, and others, have difficulty learning to program in unity, it is provable, from the testimonies of developers who use it, and from Unity’s success, that it is a great engine with great docs.

So when you say things like:

Especially with the profanity, it is beyond belief. We as programmers have read the docs, learnt to use the engine, FOLLOWED THE PAGE ON ACCESSING OTHER GAME OBJECTS ALREADY LINKED IN THIS THREAD, and your coming here and saying that they haven’t even documented it?

From the viewpoint of those who have bothered to put in the time and effort this appears to simply be a case of ‘I’m too lazy to learn it myself, I’ll blame unity’. It is simply unbelievable that you could seriously have gone through so many tutorials, and yet not even notice the bit where it explains your very question.

And finally, I would like to point out, that as much as the world has become a nicer place, some truth still exist. There is a right way and a wrong way to program. And ultimately, it is YOUR problem, if you as a programmer, cannot understand the documents. Ultimately this:

Is true. A programmer is, in many ways, a translator. If he (or she) cannot express themselves in a way that they can be understood they are worse than worthless, they are a hindrance.

Before you take the above wrongly, I’ve made this clarification nice and bold. We are happy to help you learn, and I am more than happy to help you write your tutorials. But ultimately blaming the doc’s as they are is a failure on your part, because as a programmer the docs are part of your tools. Improving is one thing, complaining is another.

Is there a correct way to “take” passive aggression?

@NPSF3000

You’re falling down the same well as many others have when commenting on my comments. That is, saying “go become a programmer, then come back”.

I’ve gone down that road before, in terms of disputing it as a counter point to the point I’m trying to make.

Your other assumption, that this is about me, also wrong.

I’m trying:

  1. to help point out an issue in the documentation for NON PROGRAMMERS NEW TO UNITY that sits at the heart of how Unity works/is
  2. to find an alternative means to inform, educate and keep new comers to Unity via documentation that hits the fundamentals of the Unity approach to interactivity, hopefully from a whiz programmer.
  3. to clarify that documentation, within the Unity engine/entity is possibly the best form of future marketing, at the least cost

Sundry facts. iOS and touchscreen content consumption devices are exploding in popularity. If you think it’s peaked, or a fad, think again.

Corona SDK, GameSalad et al, they’re going to be challenging Unity’s space at the VC funding table over the next 12-18 months.

Like it or not, Unity is competing with GameSalad, Corona, Cocos2D/3D and a couple others you don’t want to say the names of. While I’m sure most here want to be considered in the “core” space of the big name core engines and rationalise their choice of Unity in the same way a married man rationalises buying an SUV over a real sports car.

Zynga has effectively taken control of Cocos2D’s future. And, likely, by extension, will dive into Cocos3D at some stage. It’s too early to tell what they’re going to do with Cocos, but it’s clear they’re already familiar with it, love it, and want to do many things with it.

Corona is THRIVING! GameSalad is reconfiguring, may fail. But then again, may not. It’s the only one to offer a kind of visual programming at this stage, built in.

Unity has the biggest staff of these guys, by a LONG way. HUGE staff compared to the others.

That was then. This is now. As I’ve said before, you’ve missed a few beats of the drum.

I’m going to have one last shot at this. Go on, yawn.

My point has nothing to do with my cognition, or lack of.

It is, to be as exact as I can, to do with what I consider to be the core benefit of using Unity and its approach to being an engine.

This part: The Object: Component: Script association and their relationships with the Update functions.

I simply LOVE this part of Unity. It’s fantastic. Wonderful. In fact, delicious to even consider. I relish the freedom to express ideas within this framework when I’m away.

My point, therefore, is that I wish others, coming to Unity bewildered and confused as I once was, about the nature of these things, to see these associations and relationships as I now do. Hopefully much clearer, sharper and with more contrast and saturation than I do. But to see.

Unfortunately my skills in programming and maths, as you rightly point out, SUCK! So I’m the last person should be teaching or helping anyone else with regards seeing what I now perceive at the edges of my vision.

Unity, for its part, built this thing, but doesn’t seem to yet see what it’s built or how it applies to the Post PC era we’re now apparently living in. Literally millions of touchscreen devices are selling every week. Wireless content consumption computing devices. The Post PC era.

We’re not in the days of garage Indy Devs tirelessly working on their sacrament to a gaming past whilst dreaming of a PC cloud. We’re past that point. Any moment expect a flood of creatives realising they need an engine to develop for iOS and Android and webOS. (Rim won’t matter anymore, you can buy puts on them about now) They’re going to realise the new frontier is interactivity, that HTML5 and JavaScript, for all their promise, just won’t cut it in the app stores when competing against “real” ‘apps’. So they’re gonna be wanting to make games or some other form of interactive entertainment that “gamifies” a more traditional activity/medium of content/entertainment.

If Unity misses out on this next big surge of users, they’re going to miss out on their next round of funding. That’s where you should all be concerned. You see, dear friends, Unity is on the funding merry-go-round. Not the BigGame.BigIncome.BigEngine merry-go-round.

Corona has taken a lot of the “early adopters” in this field. And may have passed Unity in daily use/production and exposure in the appstore space. Despite only being 2D. Unity has perceived the threat of Corona and Cocos2D for a while. It’s likely why they dropped the “3D” from common use when describing/naming their product a while back. They’ll say it’s to avoid confusion with other ideas of 3D that Unity3D 3.0 was a mouthful etc… but the real reason was/is to compete with Corona and Cocos2D without putting people off with the scare of “3D”.

What they should have done… buy SpriteManager 2.0 from that guy, and hire him on a heavy bonus contract, feed him some support staff and see how far he could push that technology (and EZGUI) if he had nothing else between him and exploring their potential as builtin components of Unity. Then rename Unity3D to Unity23D or something MUCH better than that.

But now I’m thinking for them, and completely off topic.

So, to sum up:

Docs for NOOBS! Inside Unity, that explain the insides of Unity. For Noobs. Not programmers. Everyone got it?

What do you call passive aggression?

http://en.wikipedia.org/wiki/Passive_aggressive_behavior

Isn’t helping me.

WOW. You may have found one of the least helpful Wikipedia pages of all time. I can’t believe that drivel. Who wrote that nonsense?

before you think it… allow me to show you your correct mental response at this time. “look who’s talking…”

I am agreeing with dissidently here to some extent. He is right that the component-gameobject relationship in unity is very good. Also the documentation is there but a new user has to do a lot of research for simple operations. I am talking about new programmers here mind you. Even i had some trouble while finding what i wanted and had to ask my queries on this forum which is awesome but sometime even on this forum my queries went unanswered. But with a little bit of research it is possible to find what you want. There needs to be some more tutorials on 2D game development here which are simple to understand. I am developing a 2D game like bejeweled for which there are no tutorials anywhere and i had to piece information together myself for that.

Well, I have to agree a bit with both sides…
Unity is not lacking documentation, and yes, the documentation targets programmers, and expect programmers to have already some good experience in C# or JavaScript. And yes, it should be that way. Non-programmers shouldn’t be messing with the documentation, and they do not have to learn programming from it, Unity expects, and expects correctly, that you already know programming before you delve into scripting.
NOW, the other thing is tutorials. Here I indeed think Unity has a lot to do. In Tutorials, one should learn about the Unity basic flow, get a grasp of how Monobehaviour works, a bit of integrating scripts with gameobjects, changing other scripts variables, etc, in a “Unity for Dummies” format.
I can’t say too much about it though, as I didn’t do any tutorial or took too much time in the documentation to learn how Unity works, and being a seasoned certified C# programmer, it didn’t take a while for me to convert how things are done in Visual Studio to the Unity way of parsing C#, but I can understand there are new people in this programming business, so a large tutorial database in Unity inner workings would be nice, although the scripting documentation seems pretty well done as a reference to programmers.

That never happened. Unity has always been just Unity from Unity 1.0, nothing was ever “dropped”, it was never called “Unity3D”. This is the Unity3D engine, nothing to do with Unity.

http://forum.unity3d.com/threads/29565-Ummm-this-seems-a-bit-odd?p=192794&viewfull=1#post192794

–Eric

@Marrrk

don’t know why I don’t receive emails when I get replies… I believe I have enabled this feature.

anyways… yea… I found out that I could just do a GetComponent with the script name… but come on… that is not what it says in the document :slight_smile:

it says somthing like scriptName.myvalue = 1

for a person just learning Unity3D this make no sense and does not work…

I can see there has come a couple of posts that say I’m flamming… oh… right… no I’m not flamming, I’m pointing something out that is unclear in the documentation… how you understand my post is up to you…

generally the documentation is pretty good, has examples (really nice… would like to see more)… .would like an abstraction in the forums about which scripting language used (that’s not really a documentation… but worth mentioning) .

just to put things clear… I think unity3d is really good, and the documentation is good… but that doesn’t mean I should not agree with “dissidently” post … he has a valid point…

Too many people want critisium packed in a nice little box with a ribbon on it… if that is what you want… then talk to Santa Claus… if you want to improve your system then listen to the people saying it as it is.

my two cents,
Peter

It doesn’t say that anywhere in the docs, unless your reading it out of context. That’s how static variables work, or if you cached a reference to a script with GetComponent() into a variable, eg:

var myScript = GetComponent(myScriptName);
myScript.myValue = 1;

Just to let you know, on page 118 of the Lepz 3d platforming tutorial featured in the support section of the website, there’s an example of how to link to a gameObject’s script. There’s also an example in the code on page 120. There’s also an explanation on the bottom of page 34 on when to call the GameObject.Find function because it can be slow. It’s all pretty much self explanatory…