none
Making a Unity Game, Have Errors RRS feed

  • Question

  • I am making a Unity Game, I have the errors in the build of CS0116, and CS0103 on lines 17, and 19. 

    This is my code,

    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;

    public class PumpkinScript : MonoBehaviour {
        
        void Update () {
            if (transform.position.y < -3f) {
                Destroy(gameObject);

            }
        }
        
            
        }

    private void OnCollisionEnter(Collision target) {
            if (target.gameObject.tag == "Golem")
            Destroy(target.gameObject);
            Time.timeScale = 0f;
        }
            
        

    Sunday, March 4, 2018 4:53 PM

All replies

  • I won't be answering this question, but as a regular poster, my suggestion is to mark using comments what lines 17 and 19 are, and maybe give the actual text for the two errors you mention are emitted.

    Not everyone remembers the error messages from the numbers, and with how the forums can mangle whitespace, it can be hard to determine what lines are what.

    Also, if you are posting code, try using the code block. In the toolbar above your post, where the bold italic and underline things are, there is a button to the right of the HTML with angle brackets. This will allow you to put code in your post easier.


    This is a signature. Any samples given are not meant to have error checking or show best practices. They are meant to just illustrate a point. I may also give inefficient code or introduce some problems to discourage copy/paste coding. This is because the major point of my posts is to aid in the learning process.

    Sunday, March 4, 2018 5:13 PM
  • Hi friend,

    Welcome to the MSDN forum.

    It seems your issue is about the Unity development, and our forum is to discuss the VS IDE, please redirect to this appropriate forum: https://answers.unity.com/index.html to seek for a more professional support, thank you for your understanding.

    For the error CS0103, I found a similar issue and hope it helpful for your issues.

    Best regards,

    Sara


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com


    Monday, March 5, 2018 6:57 AM