|
Post by zeroinfinite on Jun 18, 2021 23:26:17 GMT
_data.Add(new GenreScrollerData() { CoverNumber = i });
You are trying to create a MonoBehaviour using the 'new' keyword. This is not allowed. MonoBehaviours can only be added using AddComponent(). Alternatively, your script can inherit from ScriptableObject or no base class at all
What is the proper way to do this so that I do not get the warning? The code above was pasted in from the tutorial
|
|
|
Post by echo17 on Jun 19, 2021 12:10:46 GMT
Without seeing your class definition, I would just have to guess that you probably created a data class that inherits from Monobehaviour. Your data classes should be base classes or inherited from other base classes. So instead of : public class GenreScrollerData : MonoBehaviour { }
you would want to do: public class GenreScrollerData { }
Note on page 13 of the tutorial, there is no inherited class for the ScrollerData class:
|
|
|
Post by zeroinfinite on Jun 21, 2021 5:59:56 GMT
Removing MonoBehaviour from the script causes several other problems.
public class ScrollerController : MonoBehaviour, IEnhancedScrollerDelegate
This is the scroller controller script as pasted in from the tutorial
|
|
|
Post by echo17 on Jun 21, 2021 11:53:03 GMT
Please re-read my post. You need to remove the MonoBehaviour inheritance from the DATA class (GenreScrollerData), not the controller.
|
|