I decided that i’d change from UE4 to Unity because i wanted to create a 2D game, and UE4 2D support was awful, it’s been years since the latest Paper2D update.
But there’s one thing bothering me. On UE4, if i wanted, for example, a character, i would create the character class and code what i needed there. The movement, Shooting, Input Reaction, etc… Then i’d put the created character on the scene and play with it.
With Unity it seems quite different, atleast for now…
From the tutorials i’ve seen/read, i need to “create” the character on the scene. Put things on him like collision, coding the controller, animations, etc… But unlike Unreal, it was not a c++ class that has those things, but a part of the scene that has my character.
The questions are: Do Unity have a similar way to create characters? If yes, where can i learn more about it? If no, how can do i do things like passing the same character to another level?
Since i’m so new with it, even searching for such things all by myself seems really hard, so i’m sorry in advance if it’s a duplicate or something similar.,I decided that i’d change from UE4 to Unity because i wanted to create a 2D game, and UE4 2D support was awful, it’s been years since the latest Paper2D update.
But there’s one thing bothering me. On UE4, if i wanted, for example, a character, i would create the character class and code what i needed there. The movement, Shooting, Input Reaction, etc… Then i’d put the created character on the scene and play with it.
With Unity it seems quite different, atleast for now…
From the tutorials i’ve seen/read, i need to “create” the character on the scene. Put things on him like collision, coding the controller, animations, etc… But unlike Unreal, it was not a c++ class that has those things, but a part of the scene that has my character.
The questions are: Do Unity have a similar way to create characters? If yes, where can i learn more about it? If no, how can do i do things like passing the same character to another level?
Hola!
Alright, it looks like you accidentally put your paragraph twice up there, but no worries. As for your questions…
Does Unity have a similar way to create characters like UE4 does?
Short answer is no? The way you have learned that Unity creates characters is pretty much the main way to do it. However, it is pretty similar though. I haven’t used UE4 a whole lot, but even though Unity’s interface and the way it works is certainly different, this part isn’t all that different. In Unreal, you can create different types of objects like Pawns, Actors, and so on. These are your base “things” to work with. Each one of these objects has different components on it to make them behave differently. You can also obviously create classes and add these as components to the objects you make. This is very close to Unity.
Unity’s base objects are a little simpler, but similar. You have an empty GameObject and basic shapes you can work with. And then to make them do stuff, like Unreal, you add additional components to them. You do have to add your one colliders though and add a Rigidbody component if you want the object to be able to be affected by physics. So, just like you said with Unreal, you would create your own components (like input, shooting, so on) and add them to your target object.
Like you say though, it is a bit different. You do need an initial object placed in the scene if you want to work with it and add things to it. What you can do though is drag that object into your Project window to make it a prefab. This prefab that you have put in the Project window is now essentially a “blueprint” for any future instances of it (different from Unreals blueprints). You can create copies of it in your scene by either dragging it from the Project window into your scene or by having another script instantiate it (create an instance). You can then modify that prefab in the Project window as if it were a scene object.
As far as I know, that’s about as close to Unreal’s creation of characters that Unity gets. If you’re wanting to pass a player to other levels (known as scenes in Unity), there are a few ways to do that.
How can I pass the same character to another level?
- You could just go to each scene and place an instance of your character prefab at the start of each scene.
- You could create a script for the character that makes so the object (character) isn’t destroyed when you change the scene. By default, everything is destroyed when you change the scene when playing the game. If an object is told to not destroy on load, well, it won’t. It will continue to live even when you change scenes.
Let me know if that helps (or doesn’t) and if you have further questions!