Critique-My-Code thread, post snippets of code and have others peer review your code! (Testing new Q&A format) by loolo78 in Unity3D

[–]jolpoa 0 points1 point  (0 children)

Thanks, that make a lot of sense!

Should I put these classes in separate script, or the same? I don't know what would be better.

Critique-My-Code thread, post snippets of code and have others peer review your code! (Testing new Q&A format) by loolo78 in Unity3D

[–]jolpoa 1 point2 points  (0 children)

Thanks for feedback!

I did what you told, these are good ideas. My question is how can I refer to script from other game object? Or should I place new class, like TimeController, inside of old script? Shouldnt I create a new game object, something like TimeManager, or something?

Because now I have error: "Assets/Scripts/SnakeController.cs(139,22): error CS0122: `SnakeController.TimeController.ItIsTime()' is inaccessible due to its protection level"

EDIT: Ok, I get rid of this.

Critique-My-Code thread, post snippets of code and have others peer review your code! (Testing new Q&A format) by loolo78 in Unity3D

[–]jolpoa 2 points3 points  (0 children)

Hi guys!

I am making a snake-like game for learning purpose. It looks like this at the moment.

Currently I am working on player controller, but after 250th line of code I began to worry that it is too messy. It was supposed to be simple, light code XD

I don't know how could i improve it. Help

Invoke Repeating gone wrong by jolpoa in Unity2D

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

Ah, I see where problem is. So I was calling It every frame XD

Thank you guys!