Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Unity Scene

Discussion in 'General Discussion' started by Asvovsem, Sep 12, 2015.

  1. Asvovsem

    Asvovsem

    Joined:
    Nov 9, 2014
    Posts:
    3
    Hi everyone. Today i`ve discover a question for unity3D creators.
    As you could understand it`s about Unity3D scene.
    Why executable script should be placed on empty game object which is placed on a scene?
    I wonder of this cause i thought that would be enought to write some script and push the play button and look for execution.
    So i have another question why empty scene is not bothering with execution and just lets you to see that nothing is gonna happen? Instead of make you case when you could chose a script or a prefab which would show a start point for working engine?
     
  2. Asvovsem

    Asvovsem

    Joined:
    Nov 9, 2014
    Posts:
    3
    Past a minute i found UnityEngine.ScriptableObject
    But still i think its a good question to be answered on the begining of working with unity, but i think its very hard to find references to this particular class of engine.
     
  3. Tomnnn

    Tomnnn

    Joined:
    May 23, 2013
    Posts:
    4,148
    You mean like unit testing? You can create an empty scene and put your object in the scene there.
     
  4. Asvovsem

    Asvovsem

    Joined:
    Nov 9, 2014
    Posts:
    3
    I mean like you use main script to simply write game logic without attaching it to some GO.
     
  5. Ostwind

    Ostwind

    Joined:
    Mar 22, 2011
    Posts:
    2,804
    Component based software development. There are already a lot of stuff around the net on the subject which will help you understand. I think there are also existing threads here about it.
     
  6. Tomnnn

    Tomnnn

    Joined:
    May 23, 2013
    Posts:
    4,148
    I get what you mean, I had that thought when I first started using unity. You can still do this with the exception being you need at least 1 empty gameobject to hold your master script that will run other scripts. You can even make scripts not inherit monobehaviors (for your gameobjects you will instantiate...

    just make a ClassName varname = new ClassName(); like you normally would, and have a variable in the class called "go" or "body" that you set to the result of instantiating the prefab you setup for that class :)