'How can I take an int from script1 and use it in script2 on c# unity2D
I'm kind of new to c# and unity so you may find me stupid.
I tried using all the ways mentioned in this video and I got error after error. Here is Script2 and Script1
For errors I got this:
Assets\ItemCollector2.cs(6,14): error CS0101: The namespace '<global namespace>' already contains a definition for 'ItemCollector'
And this:
Assets\ItemCollector2.cs(19,17): error CS0111: Type 'ItemCollector' already defines a member called 'OnCollisionEnter2D' with the same parameter types
What I am trying to do here is to make a game where you get points for sorting garbage into specific trash cans (for school project). I got it working with only one trashcan where if you put trash with a tag(biolagunev) in it you get a point for it but if I make another trashcan which takes trash with different tag, it overwrites the points you got from the first trashcan which is why I want to get the number of points from trashcan1 so that I can add any amount of points to it from trashcan2.
Solution 1:[1]
It might be that you have 2 classes with the same name and the compiler doesn't know which to refer
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Patuqueso |
