- Home /
I cant get this code to work. What am i doing wrong?
Code:
private void Start() { Sprite[] thumbnails = Resourses.LoadAll("Gamemodes"); foreach(Sprite thumbnail in thumbnails) { GameObject container = Instantiate (GamemodeButtonPrefab) as GameObject; container.GetComponent ().sprite = thumbnail; } }
Errors: (1,9): error CS0246: The type or namespace name 'Sprite' could not be found (are you missing a using directive or an assembly reference?) (1,31): error CS0103: The name 'Resourses' does not exist in the current context (1,49): error CS0246: The type or namespace name 'Sprite' could not be found (are you missing a using directive or an assembly reference?)
Answer by _Eyesgood_ · May 07, 2020 at 10:39 PM
Two things right off I see.
Make sure you have the using UnityEngine; at the top of your class file.
'Resourses' is misspelled.
Thanks! All 3 of my Errors were from Resources being spelled wrong.
Your answer
Follow this Question
Related Questions
Counter for sprite under script from GameObject prefab 0 Answers
How do I change Sprites (and manipulate the Sprite Object) in C#? 0 Answers
how to access a float from one script in other script in different objects 3 Answers
How to run a function in a GO that have DontDestroyOnLoad 1 Answer
Add 0.5f to Vector.Right on next instantiated object ? 1 Answer