E
E
Egorian2018-02-15 13:38:04
C++ / C#
Egorian, 2018-02-15 13:38:04

How to add a variable to all objects?

I'm making a 2d platformer with Unity2D. I need all objects to have a bool canwalk variable or the ability to set this variable in the script. How to do it?
I think that this is done through classes, but I did not understand them.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Eremin, 2018-02-15
@Egorian

Well you are making a Walker class. Add it And then, all your classes inherit from Walker protected bool canWalk {get;set;}

G
Griboks, 2018-02-15
@Griboks

Go through the basic training on the site so that such questions do not arise.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question