- Home /
How unity actually work?
hi guys Im new in Unity, I study computer science I already learned c# Before i start Make a game i want to understand how unity work (unity and MonoGame Framework) So ,The photo explain my general idea about unity!
every componente had Update and start method even transform and sprite rendere ?
Camera is Component? if is true why it have audio,animation... proprty in it?
type of GameObject ?
And a lot of question ... Thanks guys
Answer by Trevdevs · Jun 24, 2018 at 07:34 PM
I love questions like this learning about the engine is one of the best things you can do right off the bat.
Every component that you can attach to an object is a script that derives from monobehaviour or is a child from a parent that derives from there. For instance you have the BoxCollider that derives from a base class of Collider which derives from MonoBehaviour
that way if you were say put in your code public Collider collider //This could be equal to a boxcollider
Not sure what you mean by audio and animation properties on the camera it does have components the camera itself is just a component as well and is put onto an object.
Feel free to ask as many questions as you need :) the answers community is a great place to quick simple questions however If you have an idea of what you want to do like brainstorming you can post something in the forums such as i did for this question https://forum.unity.com/threads/getting-player-input-for-a-text-adventure-game-using-scriptableobjects.537554/#post-3542507
also a great place to learn about the api for different class is here https://docs.unity3d.com/Manual/index.html
Also I love your little graphic it illustrates how unity works perfectly well done :)
Thanks Quick Response ! what I mean by audio and animation properties on the camera that camera it self is a Component so it have all attribute and property from Component Class
yea that's true it does however remember these are only references to memory not actual value data which is also why you can only get the values and not set them. I wouldn't go to far into the component class you'd get a headache. Unity is just dummy proofing the code for all of that aren't that smart to go in and remove what we don't need.
that great! one more question ! this.transform.position position f current Object in this case is PlayerCode(Component) but if any GameObject Contain PlayerCode(Component) will be linked to PlayerCode(Component) position
Basically any object you place that code on will set x = that objects position in world space.
Lets say you place an empty game object at (-5, 0, 0) and then attach this script to it.
if you add another line Debug.log(x); this would return -5;
I wouldn't say they are necessarly think you can have another object at (-10, 5, 10) with this same script on it and one will return -5 and the other will return -10
it's only if you were to declare that float as static would you be linking them since statics are not a reference to memory anymore
Also if your ever up for a chat I'd like to help ya out more. Since i'm starting my freshman year for computer science this fall, maybe would $$anonymous$$ch eachother a thing or two.
shoot me an email - trevor.stull720@gmail.com
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Add Cyrillic to TexMeshPro?,Add krill to TexMeshPro? 0 Answers
How do you make a car drift in unity 2D 1 Answer
2D collisions in Unity 4.3? 1 Answer