Thank you very much. It is easily one of the best tutorial (about anything!) I ever followed! I'm really thankful for this to exist, it was a really clean and proper explaination, I loved it!
@TheGrimmGamer
3 жыл бұрын
This is a total banger of a tutorial. It's organized, the explanations are clear, the end result is well produced enough to be usable for more than just a demo and you even got in a little check your understanding bit at the end with the detecting the alpha. Well done man.
@PabloMakes
3 жыл бұрын
Thanks for the kind words! Glad you enjoyed it
@parthajeetsarmah4529
3 жыл бұрын
Woah! Even for a small KZitemr your videos are high quality and loaded with information. *Chefs kiss*
@PabloMakes
3 жыл бұрын
Thanks for the kind words 😀
@fukukyun78
3 жыл бұрын
Thank you! I literally looked at like 10 different posts and several different videos, even as an intermediate developer this was very difficult to figure out lol, I was finally able to get it thanks to you!
@PabloMakes
3 жыл бұрын
Glad I could help o/
@joshduffety-wong9618
2 жыл бұрын
The most helpful Unity tutorial I've seen in a while! Subbed.
@nostalgianinja
3 жыл бұрын
Mmm! Those sexy interpolations! I'm surprised how simple color picking works. Very intuitive and the tutorial was very clear on how to get things going!
@PabloMakes
3 жыл бұрын
There’s a reason interpolate rhymes with copul- - monkatos
@paddev5901
2 жыл бұрын
Thanks for this great tutorial. It really helped me implement color into my character customizer.
@devmelonroblox
3 жыл бұрын
Man great video, you should post more like this and you deserve many more subscribers!
@PabloMakes
3 жыл бұрын
Thanks! I agree hahaha
@NotZiggs
3 жыл бұрын
Super high quality content and strangely calming. Thumbs up from me.
@PabloMakes
3 жыл бұрын
Relax while making games, what could be better?
@MindGem
3 жыл бұрын
Great tutorial. I'm a newbe to Unity and code but I feel so proud of myself to manage to get it to work even though I didn't understand and just copied the code. Now it's time for me to try to break it down and understand snippets of it. checked your vids, you should definitely make more unity tutorials.
@PabloMakes
3 жыл бұрын
Hey! Glad you got it working, definitely recommend you poke at it and try to change some stuff, best way to learn imo
@MenelikiGaming
3 жыл бұрын
Nice! Lots of useful little nuggets in here - this will come in handy! Thanks for the tutorial!
@abualfiyah9979
3 жыл бұрын
Best tutorial in this Channel, i like it...easy and complete....
@devlokavenue8364
3 жыл бұрын
u are the future of unity..
@PabloMakes
3 жыл бұрын
That's a lot of pressure, I will take being the third cousin of the future of Unity
@2Spline
3 жыл бұрын
Very helpful tutorial, thanks! (Also check out those sweet sweet interpolations!)
@kuki1940
Жыл бұрын
thank u very much! Your tutorials are very simple and helpful!
@michaelbutz284
2 жыл бұрын
Thank you so much for this tutorial. I was looking for a way to change the colour of a material that is on attached to the player. I was able to do it right away with this video. Thank you. Thank you. Thank you! Left an abo....
@PabloMakes
2 жыл бұрын
Glad I could help!
@ikhwanmz
Жыл бұрын
how do I use playerpref on this? trying to save color
@RodriGGod
10 ай бұрын
para elegir que parte del sprite pintas, tienes que haber añadido diferentes sprites a la imagen supongo, no puedes elegir q color del sprite cambiar y ya no?
@kamyasuraj131
3 жыл бұрын
Awesome tutorial and simply explained thanks
@JavierGomez-eb3of
2 жыл бұрын
exelente , todavia espues de 2 años funciona exelente
@hawwka
2 жыл бұрын
if you guys have problem with "Unsupported texture format" then you need to change texture format in advanced from default to RGBA 32 bit
@Ne0mega
3 жыл бұрын
the magic command: "RectTransformUtility.ScreenPointToLocalPointInRectangle" I am pretty sure it would have taken me a day to figure that out.. Also, to other folks, instead of null, you may need to get the camera and put camera in there, I had to as I am using "screen space - camera" my canvas.
@PabloMakes
3 жыл бұрын
Secret magic commands ftw!
@playthrive1693
2 жыл бұрын
Instead of using Mathf.RoundToInt, you should use (int) to be more precise
@chopper4402
2 жыл бұрын
This is amazing tutorial
@vensentlion4944
2 жыл бұрын
ThankYou
@blazaddo3248
3 жыл бұрын
Everything went well for me till the last if statment, for some reason that is completely disabling everything for me... i've checked the code multiple times, the only difference I have is an imported camera instead of overlay, I tried switched back to overlay and only the delta and mouse postion where updating... Everything works without the if, except the going outside of the box does as well... Any ideas? Great video btw!
@PabloMakes
3 жыл бұрын
The if for RectangelContainsScreenPoint? Have you tried passing in your camera as a third parameter? I don't do it in the video since it is optional. If that doesnt work for you, you could change where we calculate x and y, do not clamp, then add the iff there and do something like if(x>=0 && x =0 && y
@benjaminmenist
2 жыл бұрын
I had the same issue, but adding in my camera as a third parameter fixed it, thank you so much for this great tutorial and the extra help here!
@ehansytaxian
2 жыл бұрын
I love milo now
@PabloMakes
2 жыл бұрын
Strong agree
@ehansytaxian
2 жыл бұрын
@@PabloMakes yep
@MindGem
3 жыл бұрын
Hey again. I use your tutorial and it works great until i move my image. Then the color picker picks colors outside of the image. Is there a way to lock it to the image or gameobject even if i move it around? Edit: bevermind!! I missed the if statement. Now it works fine. Damn dude. This was the most useful tut ever. You gotta do more unity tutorials.
@PabloMakes
3 жыл бұрын
Glad you figured it out!
@ttheory937
3 жыл бұрын
Amazing tutorial, thank you for the useful information! What would be the best way to save the picked color so that it can be applied throughout scene changes?
@PabloMakes
3 жыл бұрын
You can make a small class that contains the data you want to save, then you can use JsonUtility.toJson to serialize it and file stream to save and load that json. I do want to make a tutorial about that at some point, but I hope this helps in the meantime o/
@ttheory937
3 жыл бұрын
@@PabloMakes It helps! Thank you
@PauloSamurai
3 жыл бұрын
Great tutorial! thanks!
@leeblackharry
2 жыл бұрын
I am trying to implement this code in my little project. I have a prefab circles that I place with left clicking in the grid cells. I would like to select a color before placing my prefab down but I can not figure how to get the color picker into my grid project. I have an empty GameObject with a script called "GridManager" on it. The script handles placing the grid tiles down and the circles. How would I include the color picker into any project?
@PabloMakes
2 жыл бұрын
Well it’s very much a case by case basis. Sounds like your GridManager handles the click event and that creates your prefab, what you can do is where the code to place the prefab is, right after open the color picker, tell your grid manager to ignore input while color picker is open, and then in the select event of the color picker, assign a color to your last created prefab and close the color picker
@attilakolumban7186
2 жыл бұрын
How can i get the color of a pixel of a RawImage, please anybody help, i am beggining to go insane.
@PabloMakes
2 жыл бұрын
RawImage has a texture slot, so you can use GetPixel on that like I show at 13:07
@sinan9205
3 жыл бұрын
Hi , I want to change prefab material color , but i can't add material color of prefab to event beacuse prefab is continuous changing .I'll be glad if you help. Also tutorial is very nice.
@PabloMakes
3 жыл бұрын
Hey, glad you liked it. You would not change the color on the prefab, but in the instances of it, so wherever you are doing your instantiate you can right after apply the color. If you need it to apply to ones already instantiated, then you need to either keep a list or modify the material they use directly. Hope this helps
@PrimosPlay
3 жыл бұрын
Thankyu pablito!!
@unnamedentity
2 жыл бұрын
Mine is so broken, it acts like the actual color picker image is like 10x the size I hover the message over the bottom left of my sprite and it isn't displaying the correct color
@PabloMakes
2 жыл бұрын
Hard to diagnose without seeing it, but sounds like maybe you are using the wrong recttransform
@unnamedentity
2 жыл бұрын
@@PabloMakes Oh wait I totally found the problem, It was with to do how the rect transform was being anchored. Its always the simple stuff, Thanks for the tutorial though, the getPixel function seems super useful for a buncha things, Sorry for the hassle
@PabloMakes
2 жыл бұрын
Glad you figured it out
@Aosa-mr5vk
3 жыл бұрын
hi, i great tutorial, i was trying this in multiplayer with photon and i couldnt see the other player colors changed, can somewone help me with this? thanks
@PabloMakes
3 жыл бұрын
Glad it helped. I am not familiar with photon, so can’t help there, but in general for sharing customization in multiplayer you have to manually sync that sort of thing
@animateit8879
2 жыл бұрын
Hi, may I ask for guidance regarding the color picker to be assign to a 3D object? where do we put the gameObject.GetComponent().material.SetColor(“_BaseColor”, theColor); in the script? I am currently having this error. Assets\Script\ColorPicker.cs(30,76): error CS1056: Unexpected character '"' its showing the error at "_BaseColor" so i am not sure how to solve it or how to set the script for it to work. PLS help and thanks in advance. Great Video btw. :)
@PabloMakes
2 жыл бұрын
Mmm, maybe the quotes you have around _BaseColor aren’t the usual ones? At least from your message they seem to have a bit of a slant. Try deleting them and typing them manually. Other than that, the line looks correct to me. Hope this helps o/
@animateit8879
2 жыл бұрын
@@PabloMakes thank you, I have retype it already but I seem to be getting another error. T.T Assets\Script\ColorPicker.cs(30,90): error CS0103: The name 'theColor' does not exist in the current context This below is the script I copy by following your tutorial. Am not sure if I put the Getcomponent for the 3d object there in the right place or not. Do I need to add anything else added to make the OnColorSelect to change the color of my gameobject? I added some things in but not sure if its needed or not. How do I set it so that there is a function to be selected in the color picker script for character model skin to change OnClick? I appreciate your reply and guidance here. Thank you Very Much!!! ❤ :) using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using TMPro; using System; using UnityEngine.Events; [Serializable] public class ColorEvent : UnityEvent { } public class ColorPicker : MonoBehaviour { public TextMeshProUGUI DebugText; public ColorEvent OnColorPreview; public ColorEvent OnColorSelect; RectTransform Rect; Texture2D ColorTexture; GameObject model; Renderer objRenderer; // Start is called before the first frame update void Start() { Rect = GetComponent(); ColorTexture = GetComponent().mainTexture as Texture2D; objRenderer = model.GetComponent().material.SetColor("_BaseColor", theColor); } // Update is called once per frame void Update() { if (RectTransformUtility.RectangleContainsScreenPoint(Rect, Input.mousePosition)) { Vector2 delta; RectTransformUtility.ScreenPointToLocalPointInRectangle(Rect, Input.mousePosition, null, out delta); string debug = "mousePosition=" + Input.mousePosition; debug += "delta=" + delta; float width = Rect.rect.width; float height = Rect.rect.height; delta += new Vector2(width * .5f, height * .5f); debug += "offset delta=" + delta; float x = Mathf.Clamp(delta.x / width, 0f, 1f); float y = Mathf.Clamp(delta.y / height, 0f, 1f); debug += "x=" + x + "y=" + y; int texX = Mathf.RoundToInt(x * ColorTexture.width); int texY = Mathf.RoundToInt(y * ColorTexture.height); debug += "texX=" + texX + "texY=" + texY; Color color = ColorTexture.GetPixel(texX, texY); DebugText.color = color; DebugText.text = debug; OnColorPreview?.Invoke(color); if (Input.GetMouseButtonDown(0)) { OnColorSelect?.Invoke(color); } } } }
@PabloMakes
2 жыл бұрын
You are trying to set the color on the Start function, that runs once when the component first starts. You need to set the color when one is selected. Ideally that would be in the callback we made for onColorSelect, but if you want to just quickly hack it, you can go to the line where it gets invoked and put your code there. TheColor would actually be named color in there
@animateit8879
2 жыл бұрын
@@PabloMakes Ah that helps a lot thank you, but one last question T.T if you don't mind. How to script it so that there is a MeshRenderer.color function in the script to be use like the Image.color for preview and background show in your video? Your previous comment did help me to fix the error issue but I dont have a function for the mesh renderer game object to get the color function in the script component. So, I can't declare the mesh game object to my script cuz there is no function to chose the color. How do I add it? and thank you for the kind reply and helping me with the issues. It really helps me in my internship. :)
@PabloMakes
2 жыл бұрын
Meshrenderer does not have a color property, you have to get the material from the mesh and change the color on the material. I believe you already had the line of code for that in your first comment
@yasarbaba2413
3 жыл бұрын
Great! How do we assign a 3d model instead of a picture? I have to assign this to 3D. Can you help me?
@PabloMakes
3 жыл бұрын
Hey! For a mesh you would do something like gameObject.GetComponent().material.SetColor(“_BaseColor”, theColor); The name of the color slot will change depending on the material you are using. Hope this helps o/
@metwinx
3 жыл бұрын
@@PabloMakes hi sir, can you explain to me more detail how to apply that code to me? i dont know here to put it
@yarosyari3516
Жыл бұрын
script link for not to copy? thx
@rufusprime0015
3 жыл бұрын
Great video! i'm just curious, how do i apply this to game objects?
@PabloMakes
3 жыл бұрын
It depends on which component you are targeting. If it’s a mesh for example, you would do something like gameObject.GetComponent().material.SetColor(“_BaseColor”, theColor); The name of the color slot will change depending on the material you are using. Hope this helps
@rufusprime0015
3 жыл бұрын
@@PabloMakes thank you so much, and thank you for the quick reply time you are a life saver!
@KeshaGo
3 жыл бұрын
@@PabloMakesHello, I would like to ask you, what if this is a sprite or material?
@PabloMakes
3 жыл бұрын
Hey! Should be similar, something like gameObject.GetComponent().color = theColor; Hope this helps o/
@KeshaGo
3 жыл бұрын
@@PabloMakes Thanks
@williamallen6382
3 жыл бұрын
In the demo, how do make the color picker appear then disappear once selected? Can you write the response as code if possible.
@PabloMakes
3 жыл бұрын
Basically we made a game object for the color picker, so you can disable raycast on that, so it cant be clicked, then make a button, when you click the button, you enable the color picker and in my case I did a nice interpolation for it(I got a tutorial on interpolations if you wanna see how to do those) and then when I select a color I do the interpolation in reverse and I disable clicking on it public void ShowPicker(bool pShow, bool pInstant = false) { PickerImage.raycastTarget = pShow; PickerRect.DOScale(Vector3.one * (pShow ? 1f : .1f), pInstant ? 0f : .35f).SetEase(Ease.OutCubic); PickerImage.DOFade(pShow ? 1f : 0f, pInstant ? 0f : .35f); } Hope this helps o/
@williamallen6382
3 жыл бұрын
@@PabloMakes is code added to the same script as the color picker or in a separate script.
@PabloMakes
3 жыл бұрын
I had this on separate script, but kinda depends on what you are doing. As long as you have access to the image component and it’s recttransform you are good to go
@williamallen6382
3 жыл бұрын
@@PabloMakes I have copied the code into a new script and I received an error message: "The name 'pickerImage' does not exist in the current context". How do I resolve that?
@Diamanrouge
3 жыл бұрын
@@williamallen6382 You have to declare PickerImage before :])
@williamallen6382
3 жыл бұрын
Is there a way to save the colours with PlayerPrefs
@PabloMakes
3 жыл бұрын
Yeah, usually the strategy to save colors is to change into hexadecimal and back. Google something like c# color to hex and I’m sure you will get some hits. If you can’t find one I have some functions I could share, but they are in an older project so hard to dig up
@PabloMakes
3 жыл бұрын
Oh actually just remembered that unity has a ColorUtility class that has this. ToHtmlStringRGB and TryParseHtmlString
Пікірлер: 90