• 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 /
This question was closed Dec 25, 2014 at 06:54 PM by Graham-Dunnett for the following reason:

Duplicate Question - http://answers.unity3d.com/questions/topics/cs0161.html

avatar image
0
Question by udubaso · Dec 25, 2014 at 06:53 PM · c#

error CS0161: not all code paths return a value

I have a problem with small code: error CS0161: not all code paths return a value. I'm a beginner in coding and please help me.

 private IEnumerator InitializeBubblesAgain()
 {
     for (int column = 0; column < BubbleColumns; column++)
     {
         for (int row = 0; row < BubbleRows; row++)
         {
             MyMaterial material = MyMaterial.GetRandomMaterial(); //get a random color
             //create a new bubble
             var go = (GameObject)Instantiate(BubbleParameter,
                                              new Vector3((float)column * BubbleParameter.transform.localScale.x,
                         (float)row * BubbleParameter.transform.localScale.y, 0f), Quaternion.identity);
             go.tag = material.ColorName;
             BubblesArray[column, row] = new Bubble(go, material);
             go.name = column.ToString() + "-" + row.ToString();
             
             var renderer = go.transform.renderer;
             renderer.material = material; //set the color
             
             
         }
     }
 }
Comment
Comments Locked
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

0 Replies

  • Sort: 

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

2 People are following this question.

avatar image avatar image

Related Questions

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

C# Script Template - how to make custom changes? 1 Answer

press e to speek -1 Answers

Is there anyway to only show a part of a GUI image during the game? (C#) 1 Answer

Script only makes character run forward 1 Answer

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