V
V
v_grachov2013-11-25 13:15:51
Unity
v_grachov, 2013-11-25 13:15:51

What are the best practices for unity3d?

Not so long ago I decided for the soul to start developing games for Unity3d. It seems that everything is clear, but do not want to make childish mistakes.
First of all, architectural patterns are of interest. How to solve the problem in large projects "the manager came and now we don't get points for the victory, but experience." How to achieve flexibility.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
afrokick, 2013-11-30
@v_grachov

devmag.org.za/2012/07/12/50-tips-for-working-with-unity-best-practices/
Develop code with components to make it easier to maintain.
Introduce interfaces and communicate through them (we are not tied to the implementation, only to the functionality).
Threat There is no single correct solution, it all depends on the specifics of the project.

H
HomoLuden, 2013-11-26
@HomoLuden

1. Don't use multiple inheritance from MonoBehavior:

class SomeBaseBehavior : MonoBehavior
{...}
class SomeConcreatBehavior : SomeBaseBehavior
{...}

I see at least one reason (if I'm not mistaken): the Start, Update and other methods, apparently, are not virtual.
2. Don't name behavior scripts after objects (prefabs, etc.). Behavior scripts should not be tied to any specific prefab
3. To receive information from "neighbor scripts" use SendMessage on your gameObject or on the parent (gameObject.transform.parent).
4. Well, probably keep a balance between the connectivity of scripts with each other and performance. Those. cache calls
GetComponent<...>(); 
SendMessage(Wrap<T> valueRequest)

which are many. The caching of the script objects themselves is still questionable for me (it seems that this should be avoided).
PS: maybe I'm wrong about something, I myself just started to actively get acquainted.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question