Question code and the output isnt matching

edub91

New member
Joined
Apr 6, 2014
Messages
2
Programming Experience
Beginner
im a NEWBIE!!! to C# and following a book... and the code isnt doing as the book says..the book is telling me to use the Unity 3d engine
plz keep it as newbie friendly as possible thank you

helpppp.png

the code and the output isnt matching up right...what am i doing wrong...
 
just an update....but nto quite a solution....

here is my code...
using UnityEngine;
using System.Collections;

public class Leaningscript : MonoBehaviour 
{
    public int myNumber = 10;

    // Use this for initialization
    void Start () 
        {
        Debug.Log(2 + 9);//non varible should show 11

        Debug.Log(11 + myNumber); //using varibles should show 21
        }
    
    // Update is called once per frame
    void Update () 
        {
    
        }
}

now the line that should appear as 21 outputs as 20...
i found out that if i change the variable in the code itself it doesnt change...
but if i change it in the inspector panel it will change...
 
Last edited by a moderator:
Back
Top Bottom