clyde Posted November 20, 2014 Well for null reference errors, the way I always solve them is to look for the reference type variables involved and do a if (object == null) { print("Object is null"); } just to figure out what is actually null. There are a set of tools out there for integration with visual studio (which you can use as a line by line debugger) but I've never gotten them to work consistently. From what I see here, this is what I think you should check I'll try that and see if I can get an additional clue. I just don't understand why the Notes.cs isn't initializing that array before MakeGrid.cs accesses it through the PopulateBlocks() method. Just a thought, the variable _prefab you use during the instantiate call doesn't seem to be referenced anywhere, is it populated? If not this would result in the noob object being null. Also, and I don't know if you are doing this, but if you have a prefab reference itself the Instantiate call will actually create a duplicate of the current in-scene object rather than the prefab it is based on. I only mention this because I made this mistake once with an enemy that can split multiple times and it took me a while to figure out since it can create odd situations. It has a public reference at the beginning of the MakeGrid.cs and I checked to make sure it was set in the inspector. Share this post Link to post Share on other sites
itsamoose Posted November 20, 2014 I'll try that and see if I can get an additional clue. I just don't understand why the Notes.cs isn't initializing that array before MakeGrid.cs accesses it through the PopulateBlocks() method. I actually forgot to mention this, but that script execution order setting only realiably affects like-methods called on a timer. So for example the all the Update() methods of one script will always fire before the Update() methods of another script. The Start() method on the other hand is always called before the first time Update() is run on a per-object basis, so if the objects are created at different times they will fire as they are available. Ultimately it means that the script execution order will only be relevant when dealing with methods like Update(), LateUpdate(), and FixedUpdate(). You could try moving the array initialization into an Awake() method which is called when the object is created, or wrap it into a custom Initialize method that you can control with a flag. For example: private bool _isInitialized = false; public void Initialize() { if(_isInitialized) { return; } // Do Initialization logic here _isInitialized = true; } Then just place a call to Initialize() at the start of any method that manipulates the array to ensure that initialization always occurs exactly once. Share this post Link to post Share on other sites
clyde Posted November 20, 2014 Thanks itsamoose. I think you just talked me through it. Edit: Yup, you talked me thorugh it. I just wrote a Set() method for stepQuantity and called it after instantiating the Notes.cs , but before accessing the PopulateBlocks() method. It works. I'm glad I asked because now it seems obvious. If I ever run into a situation where an array isn't initialized in a Start() method, I can just do do it myself like this. Thanks again. Share this post Link to post Share on other sites
itsamoose Posted November 21, 2014 Thanks itsamoose. I think you just talked me through it. Happy to help! It's nice to know that all the pain Unity has caused me over the last 2 years pays off! Share this post Link to post Share on other sites
Dinosaursssssss Posted November 21, 2014 For what its worth, I believe if you have MonoDevelop attached to Unity, it should pause and highlight the line when the null reference exception (or any other exception) is thrown. Maybe a little easier to debug than writing lines to check specific objects. Share this post Link to post Share on other sites
itsamoose Posted November 21, 2014 For what its worth, I believe if you have MonoDevelop attached to Unity, it should pause and highlight the line when the null reference exception (or any other exception) is thrown. Maybe a little easier to debug than writing lines to check specific objects. Do you happen to know if this also highlights or in some way points out the object that is null? I typically have to do things like individual print statements if I have a line that references 2 or more objects, since Unity's error reporting system doesn't say which object has a null reference, but just points to the line where the null reference was found. I'm not sure if this is standard, but working within Visual studio for XNA projects you could just hover your mouse over the variable and look at the properties of that object to quickly find out which object had the null reference. Share this post Link to post Share on other sites
Spenny Posted November 21, 2014 For what its worth, I believe if you have MonoDevelop attached to Unity, it should pause and highlight the line when the null reference exception (or any other exception) is thrown. Maybe a little easier to debug than writing lines to check specific objects. You have to have the "error pause" feature in the console window pressed for it to pause when an error is thrown, good for debugging! Share this post Link to post Share on other sites
Dinosaursssssss Posted November 23, 2014 I'm not sure if this is standard, but working within Visual studio for XNA projects you could just hover your mouse over the variable and look at the properties of that object to quickly find out which object had the null reference. Monodevelop has this feature too! I have known it to behave weirdly on occasion, but I can probably say that about most of the IDE. Share this post Link to post Share on other sites
itsamoose Posted November 23, 2014 To be honest I've used Visual Studio ever since I started programming and liked it so much I never really considered using Monodevelop as a script editor. After what I'm hearing here I'll have to give it a shot. Share this post Link to post Share on other sites
iax Posted November 23, 2014 Also you can check out Visual Studio Tools for Unity http://unityvs.com/ I haven't tried it yet as it doesn't work with the VS Express edition I've been using, however I think it should work with the new Community edition (which is basically the full VS and it's free for small teams up to 5 people I think). Share this post Link to post Share on other sites
Twig Posted November 23, 2014 I have hooked up Sublime Text 3 to my Unity, which is the best. On the rare occasion I need to do use breakpoints (I find that I almost never do when working in Unity for some reason?), I'll begrudgingly step out of Sublime. It's rare, though. Share this post Link to post Share on other sites
Dinosaursssssss Posted November 23, 2014 Just installed VS Community Edition, and it does work with UnityVS. This makes me very happy. Share this post Link to post Share on other sites
iax Posted November 23, 2014 I've started here http://unity3d.com/learn/tutorials/modules/beginner/editor these are short video tutorials explaining the basics of the editor and Unity's philosophy itself. Unfortunately it seems the Unity community (well, UE4 folks too from what I've seen) is in love with long video tutorials which are too painful for me to use so I just started to use reference and forum searches after watching the intro stuff, I think you'll get into it pretty quickly if you have previous C++ game programming experience (I have a similar background). Share this post Link to post Share on other sites
Twig Posted November 24, 2014 I've started here http://unity3d.com/learn/tutorials/modules/beginner/editor these are short video tutorials explaining the basics of the editor and Unity's philosophy itself. Unfortunately it seems the Unity community (well, UE4 folks too from what I've seen) is in love with long video tutorials which are too painful for me to use so I just started to use reference and forum searches after watching the intro stuff, I think you'll get into it pretty quickly if you have previous C++ game programming experience (I have a similar background). This is accurate and how I learned Unity as well. Video tutorials are the worst, but the Unity documentation is pretty great, and usually a specific issue will have a dozen or so Stack Overflow or equivalent answered questions. Share this post Link to post Share on other sites
Dinosaursssssss Posted November 25, 2014 Apparently 4.6 is releasing this week! http://blogs.unity3d.com/2014/11/24/sustained-engineering-plan-for-unity-4-5-and-4-6/ Share this post Link to post Share on other sites
clyde Posted November 25, 2014 Would I be able to develop Unity games on a budget notebook-computer? What requirements would you have for a notebook-computer that you intend to make Unity games with? Share this post Link to post Share on other sites
itsamoose Posted November 25, 2014 Well what do you mean by budget notebook? I bought a laptop a while ago with 8 gigs of RAM and a Core i5 Ivy bridge processor and have been able to run Unity on it just fine, although I haven't tried anything that graphics intensive beyond some of the example scenes. I think the biggest things to look out for would be RAM, processor speed which only matters up to a point, and then what shader model the graphics card supports although I'm pretty sure everything made today supports SM3 or better. If you're willing to throw a little more money at it, it might be worth getting a laptop/tablet combo so you can test touchscreen stuff without having to deploy to a device, provided you want to work on touchscreen games. Share this post Link to post Share on other sites
SuperBiasedMan Posted November 25, 2014 My laptop is a piece of crap that sometimes has trouble with HD Netflix but it runs Unity fine until I start instantiating hundreds of game objects. Share this post Link to post Share on other sites
clyde Posted November 27, 2014 So I restored a laptop we bought in 2009 for $350 to its factory-conditions. Installed all the Vista updates, removed the bloat-ware, and installed Unity 4.6. It works way better than I expected. It's going to be useful just in showing me how my stuff runs on computers with integrated video-cards. For instance, turning off the secondary camera in Yarn increases the frame-rate from 40fps to 50fps. That's something worth considering. Share this post Link to post Share on other sites
clyde Posted November 28, 2014 If you are going to use the inputField, this page will probably be useful: http://msdn.microsoft.com/en-us/library/26sxas5t(v=vs.110).aspx Share this post Link to post Share on other sites
A Tasty Shrimp Platter Posted December 2, 2014 I'm probably prematurely optimizing, but what approaches should I be looking at to getting a similar effect with different colored lights if I don't want to update settings in Unity to allow a million pixel lights? Each button in the image has it's own point light, and I plan on adding quite a few more buttons. Share this post Link to post Share on other sites
itsamoose Posted December 2, 2014 You could try a self-illuminating material, make one for each color and swap them accordingly. Just a heads up though, accessing the material property on a renderer creates a new instance of the material, so you'll want to be careful about how you do it. From the docs it looks like you'll need to use material.SetPropertyBlock() Share this post Link to post Share on other sites
SuperBiasedMan Posted December 2, 2014 Couldn't you use coloured lights and just use the code to access the colour value on the lights? Share this post Link to post Share on other sites