• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by crzyone9584 · Dec 12, 2014 at 06:34 PM · 2d-gamexna

Moving from XNA

I've been looking up all the differences between XNA and Unity3d. I've figured out the easy ones like input, vector2, etc. My issue is I'm not finding something similar to Spritbatch. So like in xna you would call spritebatch.draw() to draw your 2d object. Could someone point me in the right direction?

I have a 2d framework in xna for a 2D game that I would like to bring over to Unity to continue my game. I'm not looking to spend money on frameworks already made for 2D games. I have my own and would to figure out the drawing part. As for most of it is just C# code except for the drawing and some other pieces of the code.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by VesuvianPrime · Dec 12, 2014 at 06:41 PM

I first came to Unity from the Python PyGame module, OpenGL Glut, and C++ Allegro. These are all libraries in which you are responsible for drawing things directly to buffers as and when you need them.

Unity is completely opposite to this. In Unity you create your visual assets and instantiate them. You attach your behaviour functionalities as children (components) to these instances.

My first year or so with Unity was pretty tough as I was trying to force Unity to behave like these other engines, when Unity has it's very own paradigms.

I'd reccomend getting familiar with the relationship of GameObject and Component.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image crzyone9584 · Dec 13, 2014 at 05:45 AM 0
Share

Thanks for the answer. I'll look into the GameObject and Component of the Unity Engine. Hopefully it won't take to long to figure it all out.

avatar image
0

Answer by fafase · Dec 12, 2014 at 06:48 PM

From Xna lifecycle, Init/LoadContent could be assimilated to Awake/Start (Start is only call when the object is activated), Update is Update, UnloadContent is OnDestroy.

Draw would be LateUpdate as for when it happens but the purpose is not the same. Unity hides the rendering process while XNA still requires the call to send to the GPU. Forget about it here.

Note Unity has many more callbacks, I guess XNA had also but those are the main ones.

Also, XNA used virtual and override while Unity uses reflection to call a callback method from the lifecycle. Hence the absence of override on the front and no base.Method().

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image crzyone9584 · Dec 13, 2014 at 05:44 AM 0
Share

Yea all the Init/LoadContent, Update, and UnloadContent I've figured out. It is the spritebatch and how to draw things to the screen. Thanks for the answer This helped me a little.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Unity to Xna, is it possible? 2 Answers

There is an way to load external 2d animations in runtime? 0 Answers

How can I load and position my sprites in c#? 1 Answer

I am pro member of unity. have any bug on samsung s5 and lg g2 0 Answers

Unity engine work on Android 2.2 based on Intel x86 system? 2 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges