NEXT VIDEO: Design Patterns in Game Development 👉 kzitem.info/news/bejne/0olouYSibHl2ZqA
@landenyousef7998
3 жыл бұрын
@Briar Hugo Yup, I have been watching on flixzone for months myself :D
@valerii-barabanov-vvb
2 жыл бұрын
@@briarhugo3650 Me an my bf too bro)
@kensamonte2276
4 жыл бұрын
Not sure why this video has so many dislikes when it answered what exactly I am looking for (I got here after the Singleton video). Your style of explanation is superb. Keep 'em coming!
@sirengita3535
3 жыл бұрын
many of us were looking to get the HOW of accessing one script from another, not the explanations of the TYPES of ways to access or tie scripts together XD I personally liked this and found it interesting for the future, but I am not to the level yet i need to know this quite yet...i just need to have one script access variables from another script to change a count...this doesnt really help that, so i suspect they "disliked" it because the title is misleading
@aaron4820
4 жыл бұрын
From making that little rigidbody sphere roll around with WASD (yeah that one), to getting into enough trouble to search for this video, and be able to understand everything said here, I feel like I'm making progress...!
@uncertaintitle4116
4 жыл бұрын
Keep at it dude ^-^
@vickdeweo4288
4 жыл бұрын
Funny; same boat here. Good luck.
@joshsheppard6892
2 жыл бұрын
Lol, unity has a free player controller, sphere models, and sphere colliders in the asset store. Why did you build one from scratch? But also good job
@aaron4820
2 жыл бұрын
@@joshsheppard6892 To learn of course :P Most assets I download are shaders related because black magic can only be learned by those who are born witches and I'm not one of them, everything else I try to model / make from scratch when possible :) Helps with learning Blender etc. A year on after the original comment I posted here, I'm now very close to releasing a VR app :) (kzitem.info/news/bejne/2oWBlqitrqGgfZw)
@Pastahunter
2 жыл бұрын
I looked at the compuer. So colorful
@LokenGaming
4 жыл бұрын
"how to" is a bit misleading for people like myself looking for a tutorial. This video amounts to a list of ways you could do it.
@subliminalcastillo2126
4 жыл бұрын
I can understand where you are coming from. in the world of programming, you have to know how to take examples not 100% applicable to your situation, and be able to apply them to your situation & needs. Especially when the best documentation in the world (microsoft's own) is written in an overly complex and ridiculous format. It sucks massive dick, but it's the only dick we got, if you know what I mean. Lmfao. There are going to be thousands of different tutorials on "how to achieve (a) with the technique of (b), (c), or (d)", and only a couple of them will teach you all of the steps of b, c, & d, because by doing so, it specifies the context by focusing on the specific example, rather than the overall concept itself.
@subliminalcastillo2126
4 жыл бұрын
I'm going to put a practical example for you on the internet, I will post the link here in a second.
@subliminalcastillo2126
4 жыл бұрын
pastebin.com/yFED3Bb9
@sirengita3535
3 жыл бұрын
@@subliminalcastillo2126 THANK YOU :D
@subliminalcastillo2126
3 жыл бұрын
@@sirengita3535 No problem. There is a problem with the example that I posted... Once you tell Class A that he can find the data he needs in Class B- Class A cannot exist without Class B. Therefore, A becomes tightly coupled with B, and that will always be something you have to work around moving forward as your project grows. The video itself is actually centered around that fundamental problem, and is geared towards helping more experienced people who are trying to implement some modularization in the way that they access data between classes, as opposed to just an example for somebody who needs access to a variable from another class in any way possible.
@nexxogen
4 жыл бұрын
One suggestion for Charles. This video is meant for people with a little bit more experience. It's technically a "best practice" video. Having this in mind, parts where you explain what a script is, are absolutely unnecessary as people who would be interested in this topic surely already know that much. It made me lose interest very quickly and I can imagine there were more who felt the same way. Try not no mix beginner things with more advanced things in the same video.
@jackeatock3888
4 жыл бұрын
Brilliant Video. Cheers mate.
@madouche
4 жыл бұрын
Thanks for the information. That really helps
@senchov
5 жыл бұрын
There is one approach with interface serialization. More accurate to say with restrictions of interface in editor. You can write custom property drawer and check is Object implement ISomeInterface, and if not, set serializeproperty.target = null Code will look like this [Validate(typeof(ISomeInterface))][SerializeField] private Unity.Object MyField; private void Start () { (MyField as ISomeInterface).DoSomething(); }
@ZloyDinozavrik
5 жыл бұрын
Thanks man
@sirengita3535
3 жыл бұрын
good explanations of the way these things work but your title is misleading. Please change the title to something more technical to more accurately reflect the level of content.
@inhabitantwaps3qs803
4 жыл бұрын
you can use this to easily reference any scripts float.bool.string or variable. copy here: using System.Collections; using System.Collections.Generic; using UnityEngine.UI; using UnityEngine; using [YOUR OTHER SCRIPT NAME HERE]; public class colorize : MonoBehaviour { [YOUR OTHER SCRIPT NAME HERE/NAMESPACE] [GIVE IT A NAME HERE eg]; // Start is called before the first frame update void Start() { [eg]= GetComponent(); } // Update is called once per frame void Update() { NOW PUT eg. BEFORE ANY FLOAT , BOOL, STRING OR VARIABLE YOU WANT TO ACESS AND IT WILL BE IDENTIFIED. eg.[VARIABLE] } }
@MrSumpner
5 жыл бұрын
6.04 The AudioService expression-bodied property returns a new AudioService every time it's called, which isn't a singleton, just a mistake. Not so 'infallible' now!
@donalodomhnaill
2 жыл бұрын
vid starts at 2min in....
@moocowp4970
4 жыл бұрын
So if code is running in an OnTriggerEnter() event and I know the collider is another Player (because I've checked the tag of the collider's object to make sure it's a Player), how can I change a public variable in one of that player's scripts (E.g. set a bool called isTagged to true)? Visual Studio/the code doesn't know at the time of compiling that it's going to be a Player that collides with the collider, so it doesn't give me the option to reference isTagged or even the script that isTagged is in. Any ideas?
@aldigangster123
4 жыл бұрын
It's easy. Within OnTriggerEnter() you create a temporarily variable and assign the collided object to it: "Player player = other.GetComponent();" In the next line, you now simply check if player variable is not null "if (player != null) { player.MyBool = true; }", because in case the colliding object is NOT a Player, the "player" variable will be null, and your if check fails and will not execute the code.
@WebstersYouTube
4 жыл бұрын
I came here with what I thought (hoped) was a simple question and just got confused. Your use of specific terminology and jargon over layman's terms makes this impossible to follow unless you already know enough about the subject matter to not need this guidance in the first place.
@kunz4164
4 жыл бұрын
ikr lol
@elijahmon6519
4 жыл бұрын
I would recommend watching more a beginner friendly channel such as Brackeys to gain a better understanding of Unity before delving into this one. This channel is generally geared towards an audience with a bit more programming experience. You could also consider joining the Discord community if you have any specific questions.
@kunz4164
4 жыл бұрын
@@elijahmon6519 Thats fine and all, but I think the title is a bit misleading, I think most people would expect a vid that shows how it works in code etc. For example the title is similar to looking up things like "How to create variables", you expect a video that shows like one line of code and then it ends up being a 10 minute video talking about what is variable, how does it hold memory, the history stuff etc lol. Maybe the title should have been "Understanding Infrastructure of blah blah". something along those lines.
@atrixiumalt3880
4 жыл бұрын
@@kunz4164 Well its probably best you know what the thing is and understand what it does before you use it.
@kunz4164
4 жыл бұрын
@@atrixiumalt3880 Smh. He makes it sound so complicated, I actually found a video that does like 2-3 practical exercise that shows you how it works and that is how it should be done, I feel like I understand everything about it now from that video whereas this is hard to understand since all he does is show snippet of code and use fancy terms. The best way to understand something is by putting it to practice so a practical example from start to finish is needed. Anyways I got what I wanted from another channel, but he should really change the title for his sake cause I bet thats where all the dislike is coming from. Some may want theory only but others might prefer a practical demonstration.
@kaniac_
Жыл бұрын
just tell me we are 2 minutes in and you are stalling so hard
@polking5353
4 жыл бұрын
This video is unnecessarily long
@TheMrgrafixable
3 жыл бұрын
get off of the top search rankings this isnt what your title claims it is
@julianseyffer1524
4 жыл бұрын
Intro way too long and you repeated some sentences in the first 2 mins...
@DAVIN-qu5yq
5 жыл бұрын
The computer was so distracting lol
@-PratyushMishra
3 жыл бұрын
How can some one resist watching such a cool game "devlopment" PC
@Misterlegoboy
4 жыл бұрын
gonna be honest this didnt help at all
@sstelect
4 жыл бұрын
Yepppppppppppppp!
@rajprashanth4804
4 жыл бұрын
Yeah dudde, he said how to access an variable from another script. What s he talking about???
@thilun9176
4 жыл бұрын
He just gave to you every beginner way to access and pass data through scripts, this videos did 100% of what the title says it will. I don't know what you need more.
@Misterlegoboy
4 жыл бұрын
@@thilun9176 none of them are actual global variables and some didnt even work at all
@happyfarang
6 жыл бұрын
scriptable objects should go on that list, really. It's a great way to share variables and can save you from some action calls with nasty GC :) I tend to use them more and more
@ZoidbergForPresident
6 жыл бұрын
Those aren't really variables, but more like plain data though, no?
@happyfarang
6 жыл бұрын
@@ZoidbergForPresident They are variables. Why, variables are data too, no? :) They are a very convenient way to pass info between scripts at least.
@argosbrave6415
5 жыл бұрын
Absolutely. Definitely needs to be talked about more. Scriptable Objects make state management so (relatively) easy.
@robosergTV
3 жыл бұрын
@Outback Games huh, why wouldn't it work? SO can have functions so you can update the values at run time, SO are not a static database
@mone9366
2 жыл бұрын
Wrong title for this video. It should be: "Review of the different methods to access variables form another scripts". This video does not show "how" to do it.
@NezertorcheaT
29 күн бұрын
dude just use .
@ArtyMartyD
3 жыл бұрын
Oh My God Get To The Point.
@grezisekr5403
3 жыл бұрын
dont get me wrong but there is a bug in your video. after one minute of talking about what you will talk about, when you finally "wanna share some of them with \us NOW", you say "...but first". this thrown my exception
@soerennielsen
6 жыл бұрын
Great video as always. I do have a request for a video/series. Would love to see you do a complete project from start to finish using Zenject. Nothing major, but still, would be nice to see how you would structure such a project :-) Cheers.
@albertparish1729
5 жыл бұрын
could you please make a more beginner friendly video covering some of these things? it's definitely a good video, but i can't manage to replicate these things into my scripts being relatively (although not completely) new at unity.
@nexxogen
3 жыл бұрын
It's FindObjectOfType() not FindObjectByType().
@hesamom1781
4 жыл бұрын
Service locator is also a nice design pattern that while in fact is a sington, it offers accessing all singtons in one place as well as easy to setup depency inversion.
@costelinha1867
2 жыл бұрын
I have that same difficulty. But I'm making games on Pygame not Unity.
@In-N-Out333
6 жыл бұрын
I like his channel. It's like an advanced version of Brackeys.
@cateyestudios6592
5 жыл бұрын
its not though
@justinc2633
5 жыл бұрын
its not more advanced or at least this video sure as hell isnt
@quoipi
4 жыл бұрын
imagine thinking Brackeys is worse than this.
@surajeswaran635
4 жыл бұрын
Quoipi he didn’t say Brackeys was worse. What he meant was his teaching is more targeted to advanced game developers, while Brackeys aims at more beginners. That doesn’t mean one is better, it’s just they both teach different targeting audiences. Not trying to sound aggressive or rants, just saying what he meant
@elderrale
4 жыл бұрын
you talk too much. this should be a 3 mins video and you made it 8.
@ZoidbergForPresident
6 жыл бұрын
1:25 gameprogrammingpatterns.com/ ? Some intriguing stuff there, and interesting.
@khiemgluong
3 жыл бұрын
*sees promising video title* *sees dislikes* *reads comments* cya
@lilugoart
5 жыл бұрын
well this was just an empty 8 minutes. Thanks for nothing
@jikrebelloza
5 жыл бұрын
Right? I can here looking for answers on GetComponent and its various forms/implementation, not this crap xD
@stejothepisto
4 жыл бұрын
Am I the only one in the world that struggles with saving High Score on another scene?????
@joshualonge1384
3 жыл бұрын
yes
@justindsouza8104
2 жыл бұрын
hey I am stuck on this highscore part....can u please help me?
I havent watched your video yet because im going to bed right now and saw this, but What about Accessing variables from other scenes. With additive scenes becoming a popular workflow, I havent seen easy ways to get objects from another scene besides FindObjectOfType or by name.
@Dom_R_222
3 жыл бұрын
Yeah not helpful at all, for anyone new.
@CaioTrinchinato
6 жыл бұрын
The lambda operator does exactly what in the AudioService instantiation?
@sparrowhawk81
6 жыл бұрын
You mean this line? public static AudioService AudioService => new AudioService(); ? It looks like a lambda but in this case it's not. It's just a quicker way to write a "getter" for a C# property. You have to set your project settings to the .NET 4 compatibility because it is a c# 6 or 7 feature. Instead of writing public static AudioService AudioService { get { return new AudioService(); } } That hash-rocket symbol basically just says "just return this". It makes writing a read-only public property that only returns a private field a lot easier.
@magnusm4
3 жыл бұрын
I've had this as my nightmare for so long. Every single time I want to work on my player control script i run into this issue: How do I get a value to other classes to control or change it?! Say I have different states and each affects the movement in some way. I want the main movement to be alone and let others manipulate it. To have a system so that anyone can change and push it, without having to write into them selves updates on everything else that needs to be updated. Imagine writing a moving state, idle state and running state and every single one has to update sliding value, falling value, or any other value associated with the main movement. Or maybe you have drag and friction and want to change it when you're on ice. But what if you want more freedom. Want others or yourself to be able to automatically just create a new surface. Would you want to have to code in every single time the default values when the player don't touch anymore or leave that area? Having to re code every scenario so that the player doesn't get stuck with 0 friction everywhere and having to update that state every time just to check whether the player is no longer affected? This is an issue some games have had and been exploited by speedrunners such as Rayman 2. Where the water only changes when you enter and leave the state, so they found ways to get out of the water without it registering and go back to regular movement. These things haunt me as a perfectionist and someone who wants to give as much freedom as possible to both the player and the creator. See it as: What would I want if I was a modder? Making it all accessible and possible to add new things without messing it all up.
@digitalconsciousness
3 жыл бұрын
Lost Relic Games channel has a video about this. I am going to try his method. He created the children objects in the parent making them serialized fields, then dragged the scripts for those children onto the spots on the visual editor or whatever it's called, for the parent object. Then, for the child objects, he created an instance of the parent object, made it a serialized field, then dragged the parent script onto that spot in the visual editor, for the children scripts. At first it seems like the parent is creating the children and the children are creating a new instance of the parent, but that's apparently not how it works out, because by dragging the scripts into the spots on the visual editor, you link them together so it knows that instance that you created is referring to the correct one, if that makes sense.
@MrChipoclas
3 жыл бұрын
soooo how do I do it?
@BlakeKane
4 жыл бұрын
You can use generic unity events to pass vairables when needed.
@foreignwarren7361
2 жыл бұрын
How do you access variables on clones (Instantiated prefabs) from another script
@magnusm4
3 жыл бұрын
Collaborators are hell. On one side making a single script handle everything is just wrong and gets messy. On the other hand I want to avoid dependencies as much as possible. Wish I remembered that one video on Scriptable Objects about how to avoid this with them. So that deleting or removing a script or player doesn't cause the whole thing to collapse and go error.
@louismastbooms5048
4 жыл бұрын
You look like my gta character lol
@InfallibleCode
4 жыл бұрын
Idk if that's a good thing or a bad thing, but I'll take it xD
@louismastbooms5048
4 жыл бұрын
@@InfallibleCode Haha no I was just wondering around youtube to see how to improve my trash game that no one plays lol
@Brandon_Gui123
Жыл бұрын
Good video! It’s important to know that there’s no such panacea when it comes to this
@kindalost2495
3 жыл бұрын
As a beginner there's a lot of terms you use... now am confused also this are different ways to access not "how to"
@Exaris79
Жыл бұрын
This helped a lot since my team mates put their codes in a nested assets folder and made it difficult for everyone to call on their methods.
@rightdelo
2 жыл бұрын
THANK YOU!!! Amazing one-stop go-to video for an overview of the options developers have at their disposal to code properly!!!
@anilaisor
3 жыл бұрын
how do i check a value from another code so if something happens in the other code i can do something on this one
@faltatchannel4373
4 жыл бұрын
pleas could you explains to us the conflict between transforming a class into an object and And to make the class inherit from another class by writing the name of the second class in place of Monobievior?
@leewriter4656
3 жыл бұрын
Jesus... three minutes in and just a bunch of hot air blowing!
@alsgaming1426
3 жыл бұрын
is there a way to set a bool as inactive or active from another script it was not very clear
@alejandrofuentes9287
5 жыл бұрын
Did you explain how to migrate a global variable between scripts?
@yahyayozo8660
4 жыл бұрын
Really an amazing channel with very nice detailed videos ... I 've just discovered keep going
@SqrlyCode
6 жыл бұрын
Great Video, keep up the good work. However some use cases where you would recommend Singleton vs Dependency Injection would be great.
@onemoment7368
3 жыл бұрын
Some high level stuff...
@nielsd8097
6 жыл бұрын
No link in description for download of sponsored asset? :)
@InfallibleCode
6 жыл бұрын
Oops! Thanks for the heads up ;D
@exceedaccel5019
2 жыл бұрын
honestly this is so confusing without proper step by step tutorial how to do it. of course it"s because we are dumb but we need it anyway
@usamazaheer4608
5 жыл бұрын
You make so amazing and to the point videos. Thanks for sharing your knowledge, I'd love to see more videos like this ... I've just started learning Unity Development.
@LunarBulletDev
4 жыл бұрын
Just do scriptname.variable , use that declaration as you wish, example: script1 public bool test3 = true; script2 script1.test3 = false; //here i modified another variable (changed its value from true to false) through a different script
Пікірлер: 114