Q blockbreaker serialized variable gives array error?

Assets\Scripts\Paddle.cs(6,2): error CS0270: Array size cannot be specified in a variable declaration (try initializing with a ‘new’ expression)

exactly typed what rick did still get this error? Also in my visual studio editor i dont get all the pop up help comands rick does ???

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

public class Paddle : MonoBehaviour
[SerializeField] float screenWithInUnits = 16f;
    // Start is called before the first frame update
    void Start()

    // Update is called once per frame
    void Update()
        Debug.Log(Input.mousePosition.x / Screen.width * screenWithInUnits);   

You have it placed outside the brackets, needs to be inside.

ok ic.
thx david any ideer why i dont get the same auto fill commands as rick does when typing in commands ? do i need to install a unity library in vizual studio editor for that to show up? btw i had to install mine seperately as non was included when i installed unity ? This wasnt told in the lesson but the one downloaded from microsoft seems to work ok exept for the missing auto fill commands .

thx again David. :wink:

I’m glad, @David_Lamonaca was able to help you. :slight_smile:

See also:

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms