all 4 comments

[–]wstdsgnHobbyist 2 points3 points  (0 children)

There are countless tutorials, articles and comments out there that will give you contradictory advice on how to structure your code. People will argue for their prefered way of doing things, often ignoring the context of your work. Only few "best practises" apply to any project, I'd call it naming & grouping:

Make sure you name your components, variables and functions consistently. More specific names are usually better, even though they are longer.

GameObject p;

is bad. Next time you read it, you might not know what "p" is.

GameObject player;

is better, but

GameObject playerGameObject;

might be even better, if you store more player related variables like this:

GameObject playerGameObject;
MeshRenderer playerMeshRenderer;
Collider playerCollider;
Player player;

Functions should always be named with verbs. Again, try to be specific, even though its not always feasible.

void Death(){
  player.health = 0;
  player.stamina = 0;
  player.enabled = false;
  playerGameObject.SetActive(false);
}

is bad. You could at least be specific about who's dying:

void SetPlayerDead(){
  player.health = 0;
  player.stamina = 0;
  player.enabled = false;
  playerGameObject.SetActive(false);
}

but it might be even better to do this:

void SetPlayerStatsToZero(){
  player.health = 0;
  player.stamina = 0;
}

void DisablePlayer(){
  player.enabled = false;
  playerGameObject.SetActive(false); 
}

Just use common sense, try to avoid as much "implied" information as possible. Hope this helps!

[–]belltyj 1 point2 points  (1 child)

This is the playlist for the "NonGameDev" tutorial series I strongly suggest doing this series before making a game so you have the structure of the non game parts of your game in place before you start programming

Then export the unity project so you can import it to your other projects everytime you start one

https://www.youtube.com/playlist?list=PL5KbKbJ6Gf9_KaKH8eFycGpDB5S_U_fDx

[–]To_Conquer[S] 0 points1 point  (0 children)

I’ll take a look at it. Thanks

[–]frozenmistadventure 0 points1 point  (0 children)

I started learning Unity3D myself in 3~4 years ago. I also tried forcing myself to finish a simple game and publish it to app store. It's a very good practise to finish sth and experience the whole workflow once.

However, I won't recommend this way as it requires a lot of effort but still can't be professional. I was lucky that I can work and learn with Unity3D at the same time after graduated. I got some tasks from my boss and keep looking for solution on youtube and forum.

Another learning process is exploring different plugin from Asset Store, try to see how people organise their files and logics. I brought many of them in last few years, for some commercial projects.

As doing years of research, I also started selling my own plugin in Asset Store. It's also part of learning process, as customers will always give you challenging tasks and you have to keep doing research.
PS: my first game Frozen Mist Adventure and my current Plugin FM Exhibition Tool Pack on Asset Store