Unity Tutorial 03

 This week in Unity was a challenging one to say the least. While initially the concepts explored were the same (e.g. placing objects on the stage, linking scripts to objects in the hierarchy and writing basic C# code segments) suddenly the difficulty ramped up and I was learning about prefabs, out of bounds objects and random positions.

The funny thing is that while almost all of that was new to me I found it easy enough to follow along with as long as I paid attention to the tutorial. I wouldn't say I'm a fan of using Unity yet but I'm liking that the code is beginning to make more sense to me and the workspace actually does seem familiar now.


However having said all that there was one issue I ran into twice that almost made me lose my mind. When using the random method in one of my C# scripts for spawning animals in random positions, I got the following error: "'Random is is ambiguous reference between 'Unity.Random' and 'System.Random' "

How I felt when trying to solve my code problems! Image by Andrea Piacquadio, available at Pexels.

I ended up watching the tutorials again and again but still couldn't figure out what I was doing wrong so I turned to google and found this forum post about the same issue for someone else's project. It was only then when I fixed the line of code at the very top of my script that the game would compile and run normally again. I have no idea how this happened but sure enough the line of code I initially had in my script was nowhere to be seen in the video tutorials. If anything I've learned the power of a well formed Google search!

Comments

  1. Hello Michael so as I am reading through your blog about unity tutorials I also got a lot of Help from what you said about prefabs and about placing your objects which was the only thing that was easy for me to do do and then adding the script on the objects was really difficult because I live in know how many you need to add on each object and I have like a lot of objects to just to add on. It's funny how you said you watched the unity tutorials to help you out because I'm also looking at the same one writing the basics c-tag c sharp script code was really difficult because it just kept making mistakes and errors which really frustrating me

    ReplyDelete

Post a Comment