Share via

i keep getting Error CS1061 when i try to recall a procedure from another class

Burkill, John 0 Reputation points
2024-02-08T20:51:26.58+00:00

User's image

User's image

Developer technologies | C#
Developer technologies | C#

An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.


2 answers

Sort by: Most helpful
  1. David Lowndes 2,750 Reputation points MVP
    2024-02-08T20:56:45.62+00:00

    Is the Grid you're creating the same as the Grid class you show though?
    Try fully qualifying it by prepending your Assets namespace name on line 11.

    1 person found this answer helpful.
    0 comments No comments

  2. Michael Taylor 61,221 Reputation points
    2024-02-08T21:02:13.58+00:00

    You have a scoping issue here. The Grid class you defined is in the Assets namespace. Notice the reference count above it indicates it is not referenced anywhere.

    The Grid class you're referencing in MainBehaivior is not the same type. Just guessing but it is likely defined in UnityEngine. You can select the type in the file and press F12 to go to its definition.

    To fix this change the name of your Grid class. I would recommend something that clarifies it is deriving from MonoBehaviour like GridBehaviour. You should then see your MainBehaivior still sees Grid as valid, but not your type. Change this declaration to use GridBehaviour. If, after this change, you get an error about it not being defined then quick action the error and it should opt to add a using for the correct namespace.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.