Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • 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 Thiago Baptista · Aug 13, 2013 at 12:24 AM · editorprogrammingapidevelopmentframework

Programatically creating entire Unity games

This is, in a sense, a follow-up to this previous question: http://answers.unity3d.com/questions/12146/Create-Unity-scenes-programatically.html.

I am a somewhat seasoned web/enterprise developer, and I am very used to write my code "in plain text" and without the necessity of using a visual editor. Learning how to do things in a graphical enviromnent subject to future changes is costly and takes away some of our programming power.

Is it possible to create an entire Unity project without the need of the Editor - that is, programatically?

Of course I understand that, being made in a fully-fledged game engine, an Unity game requires some "boilerplate stuff" to work, such as a specific directory structure, configuration files etc. What I am asking is if we can actually, after setting up all this "framework", do something like this:

 UnityGame game = new UnityGame("My Game");    
 GameScene scene1 = new GameScene();    
 GameObject object = new GameObject();
 
 // ...do some stuff to the GameObject
 // ...such as adding behaviour, other GameObjects
 // ...Transforms, scripts etc.
 
 scene1.addObject(object);    
 game.addScene(scene1);
 

Or, in other words: can we create a game using Unity as a software developer would use an application development framework (such as ASP.NET, Java's Spring or Hibernate, Ruby's Rails etc.)?

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
Best Answer

Answer by Loius · Aug 13, 2013 at 02:11 AM

Yes. You need a master MonoBehaviour; its Start will act as your "Main" function. From there you can make and break all you need to without ever going back into Unity's editor (by the by, "Scenes" are not classes of any kind; they're really just files describing an arrangement of assets. you'd just create the objects themselves rather than adding them to any specific scene)

Though I wouldn't recommend it. Custom editors can make the design process trivial and idiot-proof. The project I'm working on is mostly external to Unity but I'm still writing lots of custom editors so the designers can make changes without talking to me all the time. Also, trying to replicate the behaviour of GameObjects without actually using GameObjects is hundreds of headaches just waiting to happen.

Comment
Add comment · Show 2 · 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 Thiago Baptista · Aug 14, 2013 at 02:33 AM 0
Share

Thanks for the answer. Is there any place/article/documentation/whatever where I can get a more "in-depth" knowledge on how to do this? I've searched the "standard" documentation and it wasn't very helpful.

I understand doing everything "by hand" without the Editor is probably a bad idea; actually, my question is more out of "curiosity", in order to get a better understanding of Unity's internals.

avatar image Loius · Aug 14, 2013 at 03:53 AM 0
Share

$$anonymous$$mmm, I don't know of any articles or anything that are all about "how to not use unity for unity" or whatever this is called.

I can give you some function names and methodology, though; Google can send you towards the right places with these hopefully:

Use Instantiate to create objects; you'll probably want to employ Pooling to keep performance with large numbers of reused objects. The Resources folder may be heavily required. Using BinarySerialization gets you small, updatable files; I binary-serialize most of the data in my project. Writing a little helper library to be able to save any System.Serializable class (which most of your classes should be) to a Resources location can help with that.

Lots of the other stuff is "common sense" (i.e. programmer know-how) and frequent, religious perusal of the Scripting Reference

avatar image
0

Answer by cdrandin · Aug 13, 2013 at 12:29 AM

I would say you can because simply the inspector is built off there own parser program for custom editors. The inspector is just middleware from what is actually being sent to the "core" of the program. This is just based of my observation of how Unity has worked with me so far and how the inspector works.

Comment
Add comment · 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

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.

Follow this Question

Answers Answers and Comments

16 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Multiple Cars not working 1 Answer

Creating Scenes Programmatically From A Deployed Build in Unity 1 Answer

No option for API Compatibility Level .NET 4x 1 Answer

Update Preference Item when Preference menu is closed 1 Answer

Unity versions across multiple developers? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges