Search Unity

2D UFO Tutorial Q&A

Discussion in 'Community Learning & Teaching' started by Matthew-Schell, Jan 22, 2016.

  1. Matthew-Schell

    Matthew-Schell

    Unity Technologies

    Joined:
    Oct 1, 2014
    Posts:
    236
    This is the official thread for discussion, issues and Q&A for the 2D UFO project

    Please use this thread if you have any questions, issues or feedback on this project.

    In your first foray into Unity 2D development, create a simple UFO game that teaches you many of the principles of working with Game Objects, Components, Prefabs, 2D Physics and Scripting.

    2D UFO is a learning project on our Learn Site:
    http://unity3d.com/learn/tutorials/projects/2d-ufo-tutorial

    The assets are available here:
    https://www.assetstore.unity3d.com/en/#!/content/52143
     
    lepakki likes this.
  2. Davrun

    Davrun

    Joined:
    Jan 23, 2016
    Posts:
    2
    Hi, I'm having a problem with the PlayerController C# script...
    I have checked my code against that from the complete pack but can't see any difference where applicable, yet I'm still getting: "PlayerController.FixedUpdate () (at Assets/Scripts/PlayerController.cs:19)NullReferenceException: Object reference not set to an instance of an object" I'm at the stage of trying to get the UFO to move. I'm guessing that this means that for whatever reason the script isn't connecting to the object (It is set as a component to the object) also is there an IDE better than Visual Studio that I should use for C# in Unity?
    Thanks
    Dave
     
  3. Davrun

    Davrun

    Joined:
    Jan 23, 2016
    Posts:
    2
    I fixed it... there must have been something wrong with my code because when I copy and pasted the section from below the video the game sorted itself out.
     
  4. tum0rc0re

    tum0rc0re

    Joined:
    Oct 14, 2013
    Posts:
    1
    Awesome tutorials. I've completed all of them :) It's better than Roguelike for beginners
     
    Matthew-Schell likes this.
  5. Israfiyl

    Israfiyl

    Joined:
    Jan 25, 2016
    Posts:
    3
    Hi, I am new to C# and Game development, I have been watching the tutorials, and they have been very useful, so thank you very much for your hard work.

    I have been trying to write a script on the UFO player movment(on microsoft Visual Studio 2015), but after i finished it, the error of "object reference not set to an instance of an object" pops at the "rb2d.AddForce (movement);" line and i can't get to control the UFO at all while trying to test play, here is the code that I wrote.

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class PlayerController : MonoBehaviour
    5. {
    6.  
    7.     private Rigidbody2D rb2d;
    8.  
    9.     void start()
    10.     {
    11.         rb2d = GetComponent<Rigidbody2D>();
    12.     }
    13.  
    14.     void FixedUpdate()
    15.     {
    16.         float moveHorizontal = Input.GetAxis("Horizontal");
    17.         float moveVertical = Input.GetAxis("Vertical");
    18.         Vector2 movement = new Vector2(moveHorizontal, moveVertical);
    19.         rb2d.AddForce (movement);
    20.     }
    21. }
    but, when I copied the code that was wrote under the video (by you guys) the error didn't pop at all, here is the code that you guys wrote.

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class CompletePlayerController : MonoBehaviour {
    5.  
    6.  
    7.     private Rigidbody2D rb2d;    
    8.  
    9.     void Start()
    10.     {
    11.         rb2d = GetComponent<Rigidbody2D> ();
    12.     }
    13.  
    14.     void FixedUpdate()
    15.     {
    16.         float moveHorizontal = Input.GetAxis ("Horizontal");
    17.  
    18.         float moveVertical = Input.GetAxis ("Vertical");
    19.  
    20.         Vector2 movement = new Vector2 (moveHorizontal, moveVertical);
    21.  
    22.         rb2d.AddForce (movement);
    23.     }
    24. }
    I removed the "public float speed;" line because it didn't matter, so my question is, why does my script get that error and why doesn't your script get it, while both of them are the exact same?
    Please help me with this and many thanks in advance.
     
    Last edited: Jan 26, 2016
  6. OboShape

    OboShape

    Joined:
    Feb 17, 2014
    Posts:
    834
    Morning,
    Have a look at your Start() function.
    The 'S' should be capitalised.

    Code (CSharp):
    1.  void Start()
     
    Last edited: Jan 26, 2016
    conward1 and Matthew-Schell like this.
  7. Israfiyl

    Israfiyl

    Joined:
    Jan 25, 2016
    Posts:
    3
    Good Morning Mr. Obo Shape, Thank you very much, I just tried your suggestion and the problem was the Capitalized 'S' for sure, I had no clue that a capitalized letter could ruin every thing and make the error appear else where.
    Thanks again for helping out, I will try and venture more on my Quest of Making Games, Good luck to both of us!.
     
  8. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,671
    Why this is happening:

    You declare the variable to hold the reference to the 2D Rigidbidy with private Rigidbody2D rb2d;

    Then you try but fail to assign the reference to an instance of the 2D Rigidbody - the instance attached to the player GameObject - in start, because it's misspelled and should be Start.

    Then you try to use the reference in rb2d.AddForce (movement);

    ... but as you failed to get the reference, the error is telling you "object reference not set to an instance of an object"

    This makes sense, because this is true!
     
    Salyangoz likes this.
  9. Matthew-Schell

    Matthew-Schell

    Unity Technologies

    Joined:
    Oct 1, 2014
    Posts:
    236
    Glad to hear it! This is definitely more suitable for beginners than 2DRL.
     
  10. oevbuoma

    oevbuoma

    Joined:
    Jan 27, 2016
    Posts:
    2
    Hi guys. I'm having problems getting my script to work. First thing is that after saving the script I get this error in console

    I don't know if its significant but when I copy the code provided at the bottom of the tutorial and hit Run, the game still doesn't respond to keyboard inputs. The UFO does not move when I press the directional keys on the keyboard. Here's my code

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class PlayerController : MonoBehaviour {
    5.  
    6.     private Rigidbody2D rb2d;
    7.  
    8.     void Start()
    9.     {
    10.         rb2d = GetComponent<Rigidbody2D>();
    11.     }
    12.  
    13.     void FiexedUpdate()
    14.     {
    15.         float moveHorizontal = Input.GetAxis("Horizontal");
    16.         float moveVertical = Input.GetAxis("Vertical");
    17.         Vector2 movement = new Vector2(moveHorizontal, moveVertical);
    18.         rb2d.AddForce(movement);
    19.     }
    20.  
    21. }
    22.  
    Thanks.
     
  11. Israfiyl

    Israfiyl

    Joined:
    Jan 25, 2016
    Posts:
    3
    Heya!

    I am not an expert but I did notice that you misspelled void FixedUpdate() for void FiexedUpdate().
    Hope I helped.
     
    Salyangoz and Matthew-Schell like this.
  12. oevbuoma

    oevbuoma

    Joined:
    Jan 27, 2016
    Posts:
    2
    Thanks Israfiyl. I didn't spot that.
     
  13. ain786

    ain786

    Joined:
    Jan 27, 2016
    Posts:
    5
  14. OboShape

    OboShape

    Joined:
    Feb 17, 2014
    Posts:
    834
    Looking at these images, looks like you haven't saved the script.
    just wondering, can you save your script, close MonoDevelop down, and relaunch the script from unity(which in turn will relaunch Monodevelop), see if that couples back up the UnityEngine namespace, and get it playing nice :)
     
    conward1 and Matthew-Schell like this.
  15. ain786

    ain786

    Joined:
    Jan 27, 2016
    Posts:
    5
    Hi,

    First off Thank You for yr prompt reply.

    Ok so even without saving, when I opened my project today, I noticed there were no error detection on main panel, So I just ran the script after attaching it to the rigid body of the player and it worked but when I open to edit the Script, again there are error detection, as shown in the above picture.

    Thankfully though, this time there are no error detection on main panel.

    My question is, why do I get these error detection on Mono Development sheet?

    I believe this is not normal, In the tutorial there were no such errors, that couldn't be fixed on the sheet at the spot.

    PS : while installing the Unity Software, there was electricity outage(it's common here in this country) , Could it be that some files got corrupt installation because I had to finish installation in 2 intervals instead of 1? (I copied over the previous files)

    Thanx in advance. Sorry if M too much of a bother !^^! .
     
  16. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,671
    Line endings are irrelevant in Unity. Scripting applications warn the user in case it makes a difference, but in our case it does not. As this is often a Mac / Win issue, it's not something we can remove, unless we authored the scripts on a per platform basis, which - as the endings are irrelevant for unity - seems a bit silly. Usually there is a pop up or tool to automatically fox these. Either use the built in fix, or ignore the warning.
     
  17. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,671
    I am unclear what your current issue is. You seemed to have solved your "speed" issue as well. Are you still having trouble? If so, please post again.
     
  18. Matthew-Schell

    Matthew-Schell

    Unity Technologies

    Joined:
    Oct 1, 2014
    Posts:
    236
    I have seen this occur in MonoDevelop before. Usually saving and restarting MonoDevelop and/or Unity will solve it. It's not based on something you did incorrectly. And no, I don't think the electricity issue is a problem.
     
  19. ain786

    ain786

    Joined:
    Jan 27, 2016
    Posts:
    5
    ok Thank You, but restarting the Unity Software doesn't work to fix it.
     
  20. ain786

    ain786

    Joined:
    Jan 27, 2016
    Posts:
    5
    http://postimg.org/image/983xp7hbd/
    Yes, Speed issue have been fixed,

    My current issue is, I get many error messages on "Mono Developement" panel, where we write code, although if I save and restart, the script works fine, but The Script shouldnt be showing error messages on "Mono Developement panel". It gives error in almost every code that I write in it, all those red words mean, they have error reading.

    Since my script works whenever I restart, I can live without fixing it but As you can imagine, It's a hassle not to be able to rectify yr code as yr writing it on Mono sheet.

    Thanx for support.
     
  21. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,671
    Have you tried to delete and reinstall Unity and Monodevelop? There seems to be an issue where Monodevelop is not "seeing" the Unity Namespace. This could be that the two applications are not communicating well. I have not seen this in person. I'd also check the health of your machine (run virus and other diagnostic checks, etc.) and also make sure that you are the admin when installing, etc., so we are sure that your machine is good and the install is good.
     
  22. krousty_bat

    krousty_bat

    Joined:
    Oct 9, 2012
    Posts:
    60
    A very good tutorial to start with Unity!
    Congrats and Thx a lot!

    - Will you make a second part, with new "simple" function to use and learn, after this one?
    For instance, enable on and off an other object (not just killing it),
    or changing a value on another object, or on a child, with different collision's test type too (like OnTriggerExit2d)...


    Thx.
     
  23. ain786

    ain786

    Joined:
    Jan 27, 2016
    Posts:
    5
    Thank You for yr advice, I'll see if I can manage it.
     
  24. Ajex16

    Ajex16

    Joined:
    Feb 7, 2016
    Posts:
    1
    Hi there,

    first thank you for this awesome and detailed tutorial for noobs like myself.

    I tried to do everything as mentioned,
    but my win text isn't following the players movement like it does in the video.

    It´s frozen on the background.

    That´s fine for me but i cannot find my mistake,
    please help me out.

    Thanks in advance.

    Bildschirmfoto 2016-02-07 um 14.00.13.png Bildschirmfoto 2016-02-07 um 14.01.06.png

    Code (CSharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4. using UnityEngine.UI;
    5.  
    6. public class PlayerController : MonoBehaviour
    7. {
    8. public float speed;
    9. public Text countText;
    10. public Text winText;
    11. private Rigidbody2D rb2d;
    12. private int count;
    13.  
    14. void Start()
    15. {
    16. rb2d = GetComponent<Rigidbody2D> ();
    17. count = 0;
    18. winText.text = "";
    19. SetCountText ();
    20. }
    21. void FixedUpdate()
    22. {
    23. float moveHorizontal = Input.GetAxis ("Horizontal");
    24. float moveVertical = Input.GetAxis ("Vertical");
    25. Vector2 movement = new Vector2 (moveHorizontal, moveVertical);
    26. rb2d.AddForce (movement * speed);
    27. }
    28. void OnTriggerEnter2D(Collider2D other)
    29. {
    30. if (other.gameObject.CompareTag ("PickUp"))
    31. {
    32. other.gameObject.SetActive (false);
    33. count = count + 1;
    34. SetCountText ();
    35. }
    36. }
    37. void SetCountText()
    38. {
    39. countText.text = "Count:" + count.ToString ();
    40. if (count >= 12)
    41. {
    42. winText.text = "Youwin!";
    43. }
    44.  
    45. }
    46. }
    47.  
     
  25. beBoss

    beBoss

    Joined:
    Feb 2, 2016
    Posts:
    14
    Well the video is edited and the author has changed something without to mentioned.

    1. Try to reset the winText (rect Transform) component from the gear menu -> reset then
    2. check the pivot and position -> just click on the rectangle in Rect Transform then hold shift + option and select centre,
    3. then just edit Pos Y "50" for example and maybe will works.

    I have no idea why is like that, just guessing what could be the problem :)
     
  26. Matthew-Schell

    Matthew-Schell

    Unity Technologies

    Joined:
    Oct 1, 2014
    Posts:
    236
    Glad to hear it was helpful. We are planning some small game mechanic focused assignments that will cover some of this stuff over the next few months, watch this space.
     
    krousty_bat likes this.
  27. Matthew-Schell

    Matthew-Schell

    Unity Technologies

    Joined:
    Oct 1, 2014
    Posts:
    236
    The text actually doesn't follow the player, it just stays fixed to the center of the screen. The reason it looks like it's following is because the camera follows the player and thereby the text (which is pinned to the center of the screen / camera's view) seems to move. Is your camera following the player properly?
     
    Salyangoz likes this.
  28. lepakki

    lepakki

    Joined:
    Feb 12, 2016
    Posts:
    1
    Hi,

    I just wanted to thank you for making this tutorial. Hands down the easiest way to get started for me. Incredibly clear instructions :)
     
  29. Matthew-Schell

    Matthew-Schell

    Unity Technologies

    Joined:
    Oct 1, 2014
    Posts:
    236
    Great! Very pleased to hear that.
     
  30. Kelvincurt

    Kelvincurt

    Joined:
    Feb 12, 2016
    Posts:
    1
    Hi,
    First of all, thank you so much for making these tutorials they've really helped me with my own 2d game and programming in C#. As you can tell, I'm a beginner and I'm still struggling to understand how to write scripts and it would mean a lot to me if you could please help me with this script... So in a recent video (Beginner 2D UFO Game 6 of 9: Creating Collectable Objects - Unity Official Tutorials) you taught everyone how to make a collectable, more specifically, how to make a collectable rotate to make it look more appealing. In my 2d game the collectable I made was a sword and I instead of making it rotate I was wondering how to make it move up and down, as if it were bouncing in the air, so if you could please help me with the script for this I would be soo grateful.
    Thanks for your time! :)
     
  31. netsuad

    netsuad

    Joined:
    Feb 15, 2016
    Posts:
    1
    Hi following along with the tutorial and got to the point where you first move the player object with the arrows, and I'm getting the error Input Axis Horizontal is not setup, this sounds like a simple fix would work, but I'm completely new to Unity
     
  32. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,671
    How have you spelled "Horizontal"? Make sure this is exactly the same as the video and remember Unity is CaSe SenSitivE, so "horizontal" and "Horizontal" (and "horizonTal") are different names.

    FWIW: The default axis "Horizontal" is already set up in the input manager. For more information on the Input Manager, you should search this topic in the documentation.
     
  33. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,671
    I can't tell you exactly how to make this script, but I could send you in the right direction. I would look in the Scripting Reference for the "Mathf" class, specifically, for a function called "Mathf.PingPing". You can use this to the the value of one of your Transform Position values (eg: transform.position.y - or which ever axis you need to).
     
  34. Salyangoz

    Salyangoz

    Joined:
    Sep 25, 2015
    Posts:
    4
    Mind blown. I was wondering why the text followed the player. Thanks for posting this, and thanks for the excellent tutorial.
     
    Matthew-Schell likes this.
  35. Matthew-Schell

    Matthew-Schell

    Unity Technologies

    Joined:
    Oct 1, 2014
    Posts:
    236
    Heh thanks :) Glad the tutorial was helpful.
     
  36. rovelius120120

    rovelius120120

    Joined:
    Nov 27, 2015
    Posts:
    1
    Hello, I've been following the tutorial and my PlayerController script doesn't compile. Unity says "Unexpected symbol 'void' in class, struct or interface member delcaration"

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class PlayerController : MonoBehaviour {
    5.     private Rigidbody2D rb2d
    6.  
    7.     void Start()
    8.     {
    9.         rb2d = GetComponent<Rigidbody2D> ();
    10.     }
    11.  
    12.     void FixedUpdate()
    13.     {
    14.         float moveHorizontal = Input.GetAxis ("Horizontal");
    15.             float moveVertical = Input.GetAxis ("Vertical");
    16.             Vector2 movement = new Vector2 (moveHorizontal, moveVertical);
    17.             rb2d.AddForce(movement);
    18.     }
    19.  
    20. }
    21.  
    Also, I've noticed in the video that you sometimes have dropdowns menus that appear to show you a list of variables and functions you can use but MonoDevelop doesn't do that for me nor does it apply color to some parts of the scripts unlike in the video. Vector2 for example is colored in the video but it's not in MonoDevleop? It says it doesn't exist in the given context. I'm a bit confused, here!

    [EDIT] Never mind about the code, I fixed it! I forgot the semicolon after declaring my rb2d variable. I still wonder why MonoDevelop doesn't apply color to certain parts of the code like it does in the video, though...
     
    Last edited: Feb 18, 2016
  37. phoenixgriffin

    phoenixgriffin

    Joined:
    Dec 14, 2014
    Posts:
    1
    I'm at the 'Picking Up Collectables' stage and I believe all the code I wrote is fine:

    using UnityEngine;
    using System.Collections;

    public class PlayerController : MonoBehaviour
    {
    public float speed;

    private Rigidbody2D rb2d;

    void Start()
    {
    rb2d = GetComponent<Rigidbody2D> ();
    }

    void FixedUpdate()
    {
    float moveHorizontal = Input.GetAxis("Horizontal");
    float moveVertical = Input.GetAxis("Vertical");
    Vector2 movement = new Vector2(moveHorizontal, moveVertical);
    rb2d.AddForce(movement * speed);
    }


    void onTriggerEnter2D(Collider2D other)
    {
    if (other.gameObject.CompareTag ("PickUp"))
    {
    other.gameObject.SetActive(false);
    }
    }
    }

    I even clicked the 'Trigger' button but when I play the UFO player can't collect any of the pickup items. They don't collide anymore but the player just sort of goes through it and nothing changes. The pickup items remain where they are.

    How do I fix this please?
     
  38. Salyangoz

    Salyangoz

    Joined:
    Sep 25, 2015
    Posts:
    4
    @phoenixgriffin is your pickup prefab tagged "PickUp" (and spelled correctly, with the capital P and U)?
     
  39. vikingjonsson

    vikingjonsson

    Joined:
    Feb 26, 2016
    Posts:
    6
    Hello,

    I wanted to learn a bit about the basics of 2d in unity. This is a really nice beginner tutorial! Keep up the great work!

    One thing I came across and started to wonder about that I'm having a bit of trouble googling is:

    When writing the script "Rotator", the tutorial shows how to drag and drop the reference.
    I usually go for FindWithTag.

    When I did this while following along the tutorial, I got my first PickUp object to rotate. When I made it a prefab and added more of these PickUps only one of them is rotating.

    When I do the drag and drop reference it works fine. Anyone know why this happens? Is there a reason or do You think I made a mistake that I'm not able to detect atm?

    Code (CSharp):
    1. public class Rotator : MonoBehaviour {
    2.  
    3.     private GameObject pickup;
    4.  
    5.     void Start() {
    6.         pickup = GameObject.FindWithTag("PickUp");
    7.     }
    8.  
    9.     void Update() {
    10.         pickup.transform.Rotate(new Vector3(0, 0, 45) * Time.deltaTime);
    11.     }
    12. }
    Regards
    Viking
     
    Last edited: Feb 26, 2016
  40. StarCmd

    StarCmd

    Joined:
    Oct 7, 2010
    Posts:
    9
    @Salyangoz I do have the exact same problem ...
    If I add this code to the PlayerController :

    Code (CSharp):
    1.  
    2. void OnTriggerEnter2D(Collider2D other) {
    3.   if (other.gameObject.CompareTag ("PickUp")){
    4.     Debug.Log ("TriggerEnter");
    5.    }
    6.  }
    7.  
    8. void OnTriggerStay2D(Collider2D other) {
    9.   if (other.gameObject.CompareTag ("PickUp")){
    10.      Debug.Log ("TriggerStay");
    11.    }
    12.  }
    13.  
    14.  void OnTriggerExit2D(Collider2D other) {
    15.    if (other.gameObject.CompareTag ("PickUp")){
    16.       Debug.Log ("TriggerExit");
    17.    }
    18.  }
    19.  
    I got plenty of "TriggerStay" in my console when the Player overlap the Pickups.
    And one TriggerExit
    No TriggerEnter
     
    Last edited: Feb 27, 2016
  41. StarCmd

    StarCmd

    Joined:
    Oct 7, 2010
    Posts:
    9
  42. vikingjonsson

    vikingjonsson

    Joined:
    Feb 26, 2016
    Posts:
    6
    Thank you StarCmd!

    I edited the script to:

    Code (CSharp):
    1. public class Rotator : MonoBehaviour {
    2.  
    3.     private GameObject[] pickup;
    4.  
    5.     void Start() {
    6.         pickup = GameObject.FindGameObjectsWithTag("PickUp");
    7.  
    8.     }
    9.  
    10.     void Update() {
    11.         for(int i = 0; i < pickup.Length; i++){
    12.             pickup[i].transform.Rotate(new Vector3(0, 0, 20) * Time.deltaTime);
    13.  
    14.         }
    15.     }
    16.  
    Now it works, I did notice a increase in speed, so I the z-rotation to 20.

    Any suggestions why the speed increased?
    I tried a foreach-loop but it would not work, any suggestions how to write it?

    i did:
    Code (CSharp):
    1. foreach(GameObject g: pickup){
    2. g.transform.Rotate(new Vector3(0, 0, 20) * Time.deltaTime);
    3.  
    4.         }
    Regards
     
  43. seankao31

    seankao31

    Joined:
    Feb 28, 2016
    Posts:
    1
    @StarCmd
    I have the same problem, too....
    I tried your script.
    But I got only ONE TriggerStay
    And one TriggerExit
    No TriggerEnter

    I currently use OnTriggerStay instead of Enter, and it works well. It still seems weird, though.

    Edit:
    After adding rigitbody 2d to the pickups, OnTriggerEnter works perfectly. Does it mean that both objects should be rigitbody 2d objects, rather than just one of them?
     
    Last edited: Feb 28, 2016
  44. StarCmd

    StarCmd

    Joined:
    Oct 7, 2010
    Posts:
    9
    @seankao31
    No : Collider may be used without Rigidbody.
    My code work.
    I did 3 things : I quit Unity, switch off my computer & go to sleep.
    This morning the code was working perfectly well. :confused:
     
    vikingjonsson likes this.
  45. StarCmd

    StarCmd

    Joined:
    Oct 7, 2010
    Posts:
    9
  46. Alben_Zap

    Alben_Zap

    Joined:
    Feb 29, 2016
    Posts:
    2
    That was a great tutorial :D Thank you so much :) ....I got one problem though...wherever black colour is there in this tutorial .....I m having pink colour over there,...mine version is 5.3.3f1....please help me..im new to unity~~!!
     
  47. Matthew-Schell

    Matthew-Schell

    Unity Technologies

    Joined:
    Oct 1, 2014
    Posts:
    236

    Generally speaking FindWithTag is not a good idea. In the case of attaching a script you should drag the script to add onto the object. In this case it looks like your script is finding a single object and rotating it.
     
    vikingjonsson likes this.
  48. Matthew-Schell

    Matthew-Schell

    Unity Technologies

    Joined:
    Oct 1, 2014
    Posts:
    236
    It sounds like maybe a material or sprite is missing? Can you post a screenshot?
     
  49. vikingjonsson

    vikingjonsson

    Joined:
    Feb 26, 2016
    Posts:
    6
    Thank You StarCmd! I guess I hade the Java syntax in mind when writing the foreach loop, now I will mos def remember when I write it next time :)
     
  50. Alben_Zap

    Alben_Zap

    Joined:
    Feb 29, 2016
    Posts:
    2
    Yeah in the sprites it was none..but I changed it into something and it turned into normal......then after building the game..the text was all pink and also is not readable
     

    Attached Files: