So, regarding the ambiguity… I can see why not - because amongst the many using
directives you have here, one of them is System
which obviously does have a Random
class, hence the issue. So, a few thoughts…
Unless you are doing something considerably more advanced than the lecture takes you through, you don’t need most of these Using
directives. What I am more interested in is how they got there, and that could simply be down to some testing/experimenting at your end, or, possibly more likely, the editor that you are using to create your scripts.
In my experience, primarily with Visual Studio, the software gives you a set of project templates that you can choose from when creating a new project (this is outside of Unity, but bear with me), these templates will create what is considered to be a useful set of files/directories for you, and in many cases will often create some basic application files, for example a web project may even provide you with login and reset password web forms.
I’m wondering if perhaps your editor has tried to be helpful and included many using directives for some kind of specific project type. In my example the only two I had were;
using UnityEngine;
using System.Collections;
…and when I look more thoroughly at my code now I can see that I was a bit lazy in that I didn’t go back and check what I actually needed. The System.Collections directive in my example is complete unnecessary as I am not using anything from that set of classes.
Visual Studio is quite kind to me on that front, I can simply hover over them and it will tell me if they are being used or not, indeed it even greys them out!
What I would suggest is removing all of the ones that you do not need, and then, as you expand the functionality of the project(s) and the code within your scripts add what you need as you need it.
I’d be fairly confident you could remove the System one which would then remove the ambiguity and subsequently the fix that you needed to put in place for it. Of course I say this without being able to see all of your code and what everything is doing, so a gentle touch would be best.
If you are not using Visual Studio then my suggestion would be to comment out one of your using directives at a time, save the script and then run the game. If everything works you can safely remove the directives you’ve commented out. If something suddenly stops working, like the music for example, you may need to remove the comment characters and leave that one in. Below is what I would guess without being able to see the whole project…
using UnityEngine;
// using System.Collections;
using UnityEngine.Audio; // I don't have this in mine in the ball script
// using System.Collections.Specialized;
// using System;
// using System.Runtime.InteropServices;
// using System.Security.Cryptography;
// using Random=UnityEngine.Random;
Hope this helps, and with regards to the other post you made about the Cryptography directive, that should be able to go also. What would be ideal is to establish what is putting them in in the first place