Here's an essential script for any game that uses a lot of windows! 🎮 Play 7 Awesome Games (Action, Strategy, Management) and Help Support the Channel! ✅ Get the Game Bundle 67% off unitycodemonkey.com/gameBundle.php
@lukax62873 жыл бұрын
Dividing by canvas.scaleFactor does not seem to work for me. Do you know why?
@CodeMonkeyUnity3 жыл бұрын
@@lukax6287 Are you using a Screen Space canvas? Did you set the Canvas Scaler like I did?
@speedrob5 жыл бұрын
Dude... loving the content, one of the top tier unity tutors on YT.
@jameslavery29585 жыл бұрын
I can't tell you how useful your tutorials are to me personally. Awesome job, thank you.
@redditgems-dailyuploads34215 жыл бұрын
Honestly, im so glad i found your channel, everything is explained perfectly, thanks !
@petelovagssecondaccount52915 жыл бұрын
Thanks for making tutorials on mechanics from your own games! It helps a lot!!
@anagr_5 жыл бұрын
Hi! Awesome as usual! 10:30 - instead of using "while" loop better use method GetComponetInParent( ) of the Component docs.unity3d.com/ScriptReference/Component.GetComponentInParent.html or GameObject.FindObjectOfType( ) docs.unity3d.com/ScriptReference/Object.FindObjectOfType.html The first one does the same things as your WHILE-loop but "out of the box". The second one goes from the top of the hierarchy to bottom and try to find the first occurrence of the needed type.
@-.._.-_...-_.._-..__..._.-.-.-3 жыл бұрын
I need to watch more of your videos. I made this waaay more difficult than it should have been.
@serialchiller91835 жыл бұрын
Thank you so much! You use KZbin in the best way! Also I love the intro :]
@kerandonovan72553 жыл бұрын
One of your best tutorials! Cheers.
@cosymonkey45725 жыл бұрын
this is exactly what ive been looking for! You rock
@srdjangrbic35063 жыл бұрын
Hi! This video is awesome and it helped me a lot. Thanks. However, I do have a few more questions and those are: 1.) How can we resize the window by dragging its edges? 2.) How can we make minimize and maximize buttons? Thanks for your answer in advance :) .
@tigransahakyan28405 жыл бұрын
Great as always) keep going )
@addisonknox50524 жыл бұрын
Thank you Mr. Monkey. Great, simple tutorial.
@jasonb2020204 жыл бұрын
Awesome as always!
@yahoruz4 жыл бұрын
hm the deviding by canvas scalefactor doesnt seem to work what could be the problem? double checked the code and adjusted it to the main project canvas?
@lukax62873 жыл бұрын
Having the same problem
@janstachu77442 жыл бұрын
Same here
@epicei3 жыл бұрын
How would I best go about making it so you can click, drag and resize these windows?
@mypaxa0035 жыл бұрын
Awesome tutorials, I like it)
@lee1davis15 жыл бұрын
Favorited this one. Very useful tut.
@hayesgeldmacher85925 ай бұрын
very helpful stuff, thank you !
@breadzo2 жыл бұрын
So helpful and easy! Thank you!
@sagiziv9275 жыл бұрын
At 10:23 why didn't you use GetComponentInParent()¿🤔
@LynJuice4 жыл бұрын
Hey nice tutorial do you have a video for resizeing the window?
@maleinanderesprison30955 жыл бұрын
can you show,.. "UI can´t leave the screen" and "automatic adjustment of the size when adjusting the screen"? thanks for this awsome video
@CodeMonkeyUnity5 жыл бұрын
Check out the Tooltip where I make it so it never leaves the screen kzbin.info/aero/PLzDRvYVwl53sN4Ewi_f-iyWZzWNmLG_bI
@maleinanderesprison30955 жыл бұрын
@@CodeMonkeyUnity Thank you! i love your content!
@elihucop5 жыл бұрын
Hi Code! Thank you for the tutorial; i have a problem with the package this not loaded scripts in some objects in the scene
@CodeMonkeyUnity5 жыл бұрын
What objects are missing? The window drag script should all be there
@SimbaGtVr4 ай бұрын
thank you so much for the script it helps out with my game a lot
@ASMRcu5 жыл бұрын
Anthor Awsome tut. And Yup i use this technique to make custom UI for player...just like PUBG ..
@antonioiliev74854 жыл бұрын
Great tutorial. :)
@shadyismad94193 жыл бұрын
How to make the windows resize if we drag the corners?
@donovansousa5694 жыл бұрын
best tutorial !!! Thanks !!
@kostyayeremenko79043 жыл бұрын
clear and helpfull, thx bro
@roll_png22 жыл бұрын
Hey guys quick tip is if you don't want it to be on top of other UI create a new canvas and place that canvas below the other UI canvas and boom
@Toopa885 жыл бұрын
8:20 literally googled that today. I use OnMouseDown/-Up/-Enter/-Exit. Is that fine or should I use your method?
@CodeMonkeyUnity5 жыл бұрын
OnMouseDown uses colliders whereas OnPointerDown uses the EventSystem. If you're trying to click on a SpriteRenderer in your scene use OnMouseDown, if you're working with UI objects use the EventSystem interfaces.
@lukenukem80283 жыл бұрын
This video makes me subscribe.
@MrLefthand3r5 жыл бұрын
Hello! Do you have a video where you implementing a resizable UI windows?
@CodeMonkeyUnity5 жыл бұрын
Haven't covered that yet, could be an interesting topic. If you use Unity's anchors it should be relatively easy, position all the children with their anchors and click and drag to modify the edges of the parent sizeDelta I'll look into it, thanks!
@MrLefthand3r5 жыл бұрын
@@CodeMonkeyUnity i find this task pretty "gimmick" if you want to do it with 8 resize points (4 in corners and 4 in the middle of each side) and behave like in any "shape editor"
@457Deniz4575 жыл бұрын
Rly usefull thanks ! :)
@__ian94__5 жыл бұрын
At 10:16, wouldn't it be easier to use transform.root?
@Mixtrate5 жыл бұрын
potentially depending on how you setup your hierarchy. If your canvas is not the root of your gameobject then I think root will not work.
@savinodelgiudice1848 Жыл бұрын
Thanks, it works great but if I wanted to make the panel stop within the edges of the canvas, how can I do?
@CodeMonkeyUnity Жыл бұрын
Do some math with the size of the window and check if the new position is valid, I did some window math in the Tooltip video for resizing it unitycodemonkey.com/video.php?v=YUIohCXt_pc
@OVXX6663 жыл бұрын
how come its not letting me assign the window to the rectTransform thing :( is it because im using sprites? its letting me assign some thing but not my whole window :(
@CodeMonkeyUnity3 жыл бұрын
RectTransform is a UI component so if you have a normal GameObject outside the UI it doesn't work with that
@venomradar14 күн бұрын
Hey how would you make the window resizable during runtime with a cursor?
@CodeMonkeyUnity14 күн бұрын
Put invisible drag objects on all sides, then when the player clicks and drags change the size instead of moving it. I covered one way to change size in my Tooltip tutorial unitycodemonkey.com/video.php?v=YUIohCXt_pc
@venomradar14 күн бұрын
@CodeMonkeyUnity thanks
@apubetico5 жыл бұрын
hey code, thanks for the video i need some help. im doing a typing game, i have a list of strings showing in the canvas, when you type the correct word, it's deleted from the list. i want a way to have a color gradient for the list, being transparent at the top and full opaque at bottom. i've done a shader for a plane that is over the list to "fake" that degradation. but is not ideal. how would you do it?
@Golem1988 Жыл бұрын
How does one prevent dragging UI window from the screeen and not getting it back on screen ever again? :D Asking this cause it may literally be the case.
@CodeMonkeyUnity Жыл бұрын
You could do some math using the width of the window and reposition it if it gets off screen, like I did with my tooltip tutorial unitycodemonkey.com/video.php?v=YUIohCXt_pc
@gamelucasdresch4 жыл бұрын
Hi CodeMonkey, This is a good video, but I have a question. I have 4 windows, 1 fixed window and 3 drag windows. When I click on a drag window, that window is moved to the bottom of the list and appears in front of the other windows. How can I make sure that only this front window and the fixed window are not transparent? Sorry my bad english...
@CodeMonkeyUnity4 жыл бұрын
You can handle transparency with a CanvasGroup, then just keep all your windows in a List and do whatever logic you want with them
@Chrizzonator4 жыл бұрын
hey nice video. But what about preventing the UI to dragged outside of the screen ?
@CodeMonkeyUnity4 жыл бұрын
The mouse itself should never be able to leave the screen. As for the window, you can look into how I did it on the Tooltip kzbin.info/www/bejne/rZjLo6qQabCEqMU
@Chrizzonator4 жыл бұрын
@@CodeMonkeyUnity I figured a solution for myself now but thx
@AdisonCavani3 жыл бұрын
@@Chrizzonator what's the solution for this problem?
@siisi44 жыл бұрын
thank you vm
@GiantBean2 жыл бұрын
Anyone know a way to make the scale or size of a window adjustable by the user? Not just scaling with the screen size or being able to scale the entire game window but scaling the window by clicking and dragging like you can do on a browser window or other PC windows?
@CodeMonkeyUnity2 жыл бұрын
There's no automatic way, you have to manually handle that logic yourself. Capture clicks on the edges of the window, listen to while the mouse is held down, increase the size of the container, etc
@GiantBean2 жыл бұрын
@@CodeMonkeyUnity it would be great to get a tutorial on this as I can't find one anywhere.
@alleyesonme14324 жыл бұрын
Hi! Great vid, but how to make UI windows stay within canvas boundaries?
@CodeMonkeyUnity4 жыл бұрын
You need to do some math based on the background size, similar to how I made with the Tooltip kzbin.info/www/bejne/rZjLo6qQabCEqMU
@kosta15705 жыл бұрын
Use dark theme for code editor. You burned my eyes :D
@CodeMonkeyUnity5 жыл бұрын
Sadly the dark editor burns my eyes
@kosta15705 жыл бұрын
@@CodeMonkeyUnity try visual studio code with atom theme. its faster and better editor with amazing color palete. and theme is very nice.
@ibrahimrashwan5 жыл бұрын
Why not just using GetComponentInParent() it's much easier !??
@grumpysalmon4153 Жыл бұрын
How can I restrict the windows to stay within screen bounds?
@CodeMonkeyUnity Жыл бұрын
Do some math with the window size and the Screen.width, I did something like that in the tooltip video unitycodemonkey.com/video.php?v=YUIohCXt_pc
@MGConstantin5 жыл бұрын
What happens if you send a window off screen ? how do you deal with that ?
@yigithanion5 жыл бұрын
If you can drag your cursor out of screen, yes you can drag window out.
@CodeMonkeyUnity5 жыл бұрын
The cursor cannot leave the screen so that shouldn't ever happen. But you can add a simple position test when dropping the window.
@TypeZ3R05 жыл бұрын
Hi, I want a help about unity!! My question is, can I make a 2D or 2.5D with vector style graphics games with cool modern particle system particle effects, AI agents, vector graphics, 2D rendering, 2D physics effect in unity personal version (free) with a low budget HP laptop. With Intel quad core i3 CPU + Intel HD 4400 graphics and 4gb ram + windows 10 ? Plzz help me 🙏
@tomicooltomi5 жыл бұрын
Should be doable but the hardware specs are a bit low for overall game development.
@anagr_5 жыл бұрын
You can but it will be so painful.
@Toopa885 жыл бұрын
4gb ram, Windows 10 and unity doesn't work together. You'll get so triggered at your laptop that you wanna throw it out of the window.
@Toopa885 жыл бұрын
When you have a low budget laptop the first thing you should do is getting Linux. While it's bad for Unity you can do a lot of other stuff and things will run much smoother.
@CodeMonkeyUnity5 жыл бұрын
Unity is free so just try it out, that laptop is enough for you to start learning.
@Ziplock9000 Жыл бұрын
ScreenPointToLocalPointInRectangle is a better 'universal' solution
@ReZpawner5 жыл бұрын
The popups are kinda disturbing the flow of the video. Could you instead put the info in the beginning or after the video? I'm sure more people would like to check out those things if they weren't in the process of coding at the time. I'd love to know what games that you've made, but not in the middle of creating interface objects.
@CodeMonkeyUnity5 жыл бұрын
I always make sure the popups never block anything so you can follow along and not miss anything.
@ReZpawner5 жыл бұрын
@@CodeMonkeyUnity They don't block anything, but they steal attention from the actual tutorial, breaking the concentration of the viewer. I can't speak for anyone but myself, but to me it had the opposite effect of what you're after. I went from "I want to know more about this author's games" to "well that was annoying, now what was I doing? Now I have to rewind." after it popped up. Personally I'd much prefer a "hey why not check out some of these games I made" at the end of the video. At that point I'm done with the work part, I could use a break, and I'm thankful for the lesson. I'd be much more inclined to check them out then.