itsamoose Posted April 27, 2014 The OnMouseDown() issue might also be related to Cursor Lock.https://docs.unity3d.com/Documentation/ScriptReference/Screen-lockCursor.html Share this post Link to post Share on other sites
1PxOff Posted April 30, 2014 Hey guys this is actually my first post here, but have been working in Unity for awhile now. One of the biggest things that helped me in Unity was finding out that you could deploy a game to an iOS device and then attach the debugger in monodevelop to the instance of the game running on your device. Just select "Development Build" when building your game. Once the game is installed on device, make sure both your device and computer are on the same network. Now start your game on your device and now you will see that instance show up in monodevelop when you connect to the debugger. Set some breakpoints and you are good to go. This is invaulable when you have a touch related bug that really only shows up on the device (lets face it the remote app sucks). Share this post Link to post Share on other sites
1PxOff Posted April 30, 2014 Here is another lifesaver if you are needing events to happen at a certain time or are just trying to get a handle on what Unity is actually doing. Unity Monobehavior Lifecycle: Share this post Link to post Share on other sites
Dinosaursssssss Posted May 3, 2014 Here's a silly little thing that I've looked up twice now: how to make 3D Text not show through all other objects. By default the text that's made when you go GameObject -> Create Other -> 3D Text uses the same shader and material as the GUI text, so its never culled and shows through all other objects. The fix is to create a new material that uses the fonts texture as its texture. http://wiki.unity3d.com/index.php?title=3DText Share this post Link to post Share on other sites
PrimeDerektive Posted May 15, 2014 Fun thing I learned yesterday: I wanted to add easing to a Color.Lerp() I was doing... the only built in function to my knowledge that is comparable to Lerp but with hermite style easing is Mathf.SmoothStep(), but obviously that only works on floats, not colors (or vectors, or quaternion, if you wanted to add easing to transform movements/rotations). But, you can just SmoothStep your t value! t = timer/duration; Color.Lerp(startColor, endColor, Mathf.SmoothStep(0.0, 1.0, t)); Tada! Share this post Link to post Share on other sites
Lork Posted May 18, 2014 So when I bought NGUI I was under the impression that it was WYSIWYG, but so far it seems more like "What You See Has Only The Most Tenuous Relationship With What You Get" (WYSHOTMTRWWYG). All I want to do right now is make some HUD elements that stay in the same position on the screen if you change the aspect ratio, but apparently that's an impossible dream. Supposedly this is done by using "anchors", but they don't seem to do that at all, and what little I could find on it in the documentation (which is extremely sparse in contrast to what was advertised) was no help at all. Does anybody know how to actually get this stuff to work the way it's supposed to? Share this post Link to post Share on other sites
clyde Posted May 19, 2014 On 5/18/2014 at 10:02 PM, Lork said: So when I bought NGUI I was under the impression that it was WYSIWYG, but so far it seems more like "What You See Has Only The Most Tenuous Relationship With What You Get" (WYSHOTMTRWWYG). All I want to do right now is make some HUD elements that stay in the same position on the screen if you change the aspect ratio, but apparently that's an impossible dream. Supposedly this is done by using "anchors", but they don't seem to do that at all, and what little I could find on it in the documentation (which is extremely sparse in contrast to what was advertised) was no help at all. Does anybody know how to actually get this stuff to work the way it's supposed to? I'm not sure, but I think it involves using the viewport. http://answers.unity3d.com/questions/351566/how-do-you-get-a-minimap-to-stay-rooted-to-the-top.html Share this post Link to post Share on other sites
itsamoose Posted May 19, 2014 On 5/18/2014 at 10:02 PM, Lork said: So when I bought NGUI I was under the impression that it was WYSIWYG, but so far it seems more like "What You See Has Only The Most Tenuous Relationship With What You Get" (WYSHOTMTRWWYG). All I want to do right now is make some HUD elements that stay in the same position on the screen if you change the aspect ratio, but apparently that's an impossible dream. Supposedly this is done by using "anchors", but they don't seem to do that at all, and what little I could find on it in the documentation (which is extremely sparse in contrast to what was advertised) was no help at all. Does anybody know how to actually get this stuff to work the way it's supposed to? I had a similar problem working with NGUI's earlier anchor system, but with little luck. How are you changing the aspect ratio? If you are just toggling the in-editor drop down? I don't believe that alone will trigger the UI rescale/reposition. Try making a button that calls Screen.SetResolution() in a standalone build with various aspect ratios and see if everything works properly. One of the issues I've found with Unity is that you can't necessarily rely on the game running in the editor to function the same as the standalone build. This is particularly true when you are changing non Unity specific elements such as the window size. For example calling Application.Quit() doesn't do anything in the editor, but works just fine otherwise. Share this post Link to post Share on other sites
1PxOff Posted May 22, 2014 Don't mess with setting the resolution. If you are using the latest version of NGUI (3.6+) you have a very nice anchoring system that will handle this for you. I have a game that has elements anchored to all four corners and center, with offsets and everything and it works across every mobile device I can get my hands on. Basically what I do is set up empty UIWidgets to represent each point that I need anchored to (topLeft, TopCenter, TopRight, etc.). Then you can set the anchor for each of those elements. The anchor is in the UIWhatever script at the bottom. Set the anchor type to "unified". It will automatically set the values to each side based on where the widget is located on the screen at the time. If you wanted to set for the top left then you set the anchor sides to be "left=target's left, right=target's left, top=target's top, bottom=target's top". Then drag that empty UIWidget up to the top corner( or set all values to zero ) Now the element is anchored to the top left and any child elements will be so as well. no matter where you move them inside of that parent, they will always stay in relation to the topLeft corner. Here is the tricky part. Dealing with multiple resolutions (this is not nearly as big a deal as before when you had things like the iPhone 3gs and the iphone 4 with retina). IF you really need to deal with multiple resolutions, then you have to build your entire UI to point to "reference Atlas" that is actually only a pointer to a real atlas. Then you have to setup multiple atlases for each resolution and then have a script that can detect what device you are on and then switch out what atlas you want to use at runtime. I hope this helps someone, if not please PM me and I can try to help further. Share this post Link to post Share on other sites
1PxOff Posted May 22, 2014 here is a quick script I wrote and published for NGUI that handles switching atlases if anyone is interested: http://www.tasharen.com/forum/index.php?topic=832 also here is a series of tutorials made by the NGUI creator. Please watch them all as they are super informative. I think tutorial 2 covers the layout system in detail. https://www.youtube.com/channel/UCQGZdUwzE8gmvgjomZSNFJg Share this post Link to post Share on other sites
Dinosaursssssss Posted May 19, 2015 Huh, here's a neat little tip I just learned: "You can enter calculations into numeric inspector fields" https://twitter.com/robotduck/status/600663317888299008 (in the tweet he puts '45 * 3' into a transform rotation x field and it magically turns into 135!) Share this post Link to post Share on other sites
Twig Posted May 19, 2015 huh wow WOW THAT WOULD'VE BEEN NICE TO KNOW FOR THE WIZARD JAM AHHH Share this post Link to post Share on other sites