
Clicker Game Tutorial Unity C#, Part 1
Simon Something
Views: 154147
Like: 1816
Hi! This is my first tutorial of a series where I’ll teach you something about making an incremental game in Unity using C#.
I’m new at this myself so hopefully this will be a good learning experience for the both of us, as I’ve never made any tutorials before.
If you haven’t downloaded unity 4.6 you can get it here:
If you’re COMPLETELY new to Unity this might be helpful:
, although it’s not necessary if you follow the tutorial step by step.
Unity Documentation:
If you liked this and want more tutorials, like, leave a comment, subscribe and all that usual stuff so I know I got an audience. No point in keeping this up if it’s not appreciated!
Thanks!
09.11.2021
i dont get anything in the script after i Place it on my button??!! Help me
EDIT: I fixed it, awesome vid tho!
Amazing tutorial.
I'm getting this error…
NullReferenceException: Object reference not set to an instance of an object
ClickForMoney.Update () (at Assets/Scripts/ClickForMoney.cs:11)
This is my code –
using System.Collections;
using UnityEngine;
public class ClickForMoney : MonoBehaviour {
public UnityEngine.UI.Text goldDisplay;
public int gold = 0;
public int goldperclick = 1;
void Update () {
goldDisplay.text = "Gold: " + gold;
}
public void Clicked () {
gold += goldperclick;
}
}
What have I done wrong??
I LOVE U.
When I tell the Click script to use GoldDisplay as a display for the amount of gold, it never shows up and the clicking doesnt work. ive retyped all of the code
I have a question if i want to build the game i have only a pink screen how ca i fix it
Assets/Scripts/UpgradeManager.cs(22,4): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
My code is:
public class UpgradeManager : MonoBehaviour {
public Click click;
public UnityEngine.UI.Text itemInfo;
public float cost;
public int count = 0;
public int clickPower;
public string itemName;
private float _newCost;
void Update(){
itemInfo.text = itemName + "nCost: " + cost + "nPower: +" + clickPower;
}
public void PurchasedUpgrade () {
if (click.wah >= cost) {
click.wah -= cost;
count + 1;
click.wahperclick += clickPower;
cost = Mathf.Round (cost * 1.15f);
_newCost = Mathf.Pow (cost, _newCost = cost);
}
}
}
(just act like every wah is gold)
what exactly did i do wrong? Its a red error so I cant play it
And this is what all of our shit will go.
You have achieved an instant subscriber
Very nice tutorial.
Hello ! I really loved this video, and yeah, why not show us how to do the menu on the left that could maybe not just appear but slip on the main screen with the updates in it ? That could be cool 😀
How can I declare my love in C#?
My canvas is really small and it won't let me make it any bigger, how do I make it bigger?
Thanks dude 🙂
Simon Something the gold display in the script click is not appearing at 14:04 somebody help
public void PurchasedUpgrade() {
if (click.gold >= _newCost) {
click.gold -= cost;
count += 1;
click.goldperclick += clickPower;
cost = Mathf.Round(cost * 1.15f);
_newCost = Mathf.Pow (cost, _newCost = cost);
}
My _newCost is quite buggy,after I upgrade ,the new cost turn into Infinity so I can't upgrade my gpc second time.
My text on top keeps duplicating plz help
Oh wow I was looking for something like this to make an click/idle game on unreal engine 4 and yeah unity seems much easier and there are almost 0 videos for unreal. So I've found your video and it helped allot. Just awesome thank you for all that nicely done explanation etc. you have a sub man
got unity yesterday finding the programming stuff difficult but i think i may learn a few stuff from these tutorials
I accidently closed Console tab and I can't get it back help?
lol…a "how to make a unity game" ad poped up XD
Ammm, okay. It turns out that I solved the CS1525 error, it's perfect, EXCEPT BECAUSE … the counter does not appear, I mean the game is fine and such, but the "Gold: 0" (example like your video) always stays at zero, although actually if you are adding points
Thank You for making this video. I was struggling with unity for a long time now. I now understand that you have to add the right component and element in the right spot.
will this game work for android?
Hi! How to fix problem with value is never used? i can't add component with this problem please help
Please can you increase the volume in these videos please, i am having problem to understand you.. I love your videos by the way. Its awesome.. Thanks!
i am a twelv year old child and you hav soiled my inoccent ears with you're disgusting langauge. REPORTED
Around 21 minutes, " Intensifies
Btw, i love you SO MUCH #NoHomo though
You Hve the best tutorial on YT!
Congrats
Help! I added the buttons and the code right (triple checked) but It still doesn't actually spend the money OR upgrade my Income. I can't figure out what the problem is
I cant upgrade?Even when I have enough currency (Sulfur) I cant.
code!! :
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class UpgradeManager : MonoBehaviour
{
public Click click;
public UnityEngine.UI.Text itemInfo;
public float cost;
public int count = 0;
public int clickPower;
public string itemName;
private float newCost;
void Update()
{
itemInfo.text = itemName + "nCost: " + cost + "nPower: +" + clickPower;
}
public void PurchasedUpgrade()
{
if (click.Sulfur >= cost)
{
click.Sulfur -= cost;
count += 1;
click.Sulfurperclick += clickPower;
cost = Mathf.Round(cost * 1.15f);
newCost = Mathf.Pow(cost, newCost = cost);
}
}
}
where did you use _newCost ??? it is not a bug
The best tutorial for incremental games. Sir, you are a great teacher <3 Respect
Thanks, very easy to understand. Im thinking about making an incremental game and had no idea where to start. Will be trying this tomorrow. I realize this is an old video but Im sure is still relevent for a beginner
anlıyorum
Thanks for it 😀 my games programming to do more trash for GooglePlay starts here 😀
You are my new Hero. Thank you.
Good tutorial
How to save the Upgrade and Items???
Hiya! Followed this tutorial to create my clicker app – https://play.google.com/store/apps/details?id=com.JasDevelop.RamenShopClicker …had to rewrite most all of it by the time I was done lol, but still have those original script names! Literally copied line by line along with the video and completely new to Unity when starting, so this was super helpful ^_^ Just wanted to say – thanks! 🙂
First
What About Idlers And Dungeons on android ? One of the most famous 😉
Awesome love this, perfect !
somebody 2019?
Hi i really need help.the numbers wont go gold and nothing will show on my screen
Hey man very nice video and useful. I will give you 5 stars!
Anyway, is it ok if i can get your advice on these android app I have posted below? I am still a beginner and hope to learn from you. Your feedback is greatly appreciated!…
You can search ' pub:Path Ahead ' in Android Play Store (P & A are case sensitive).
appreciate ya !!
HEY! for some reason my txt for the upgrades idsn't showing correctly like new line? its only showing as one line left to right…
Does Not Work My Coins Go Up By 3 then 9 and its geting some how x
Does anyone know how to fix?
Nice
4:24 Swearing in a tutorial = bad
13:30 i do it the second way, thats how i learned it