About 'Unity Scriptable Objects'!

In this video (objectives)…

  1. What is a scriptable object and why use it?
  2. Use CreateAssetMenu so that we have a context menu to add scriptable objects.
  3. Create our first scriptable object.

After watching (learning outcomes)…

Create our first scriptable object.

(Unique Video Reference: 7_TX_CUD)

We would love to know…

  • What you found good about this lecture?
  • What we could do better?

Remember that you can reply to this topic, or create a new topic. The easiest way to create a new topic is to follow the link in Resources. That way the topic will…

  • Be in the correct forum (for the course).
  • Be in the right sub-forum (for the section)
  • Have the correct lecture tag.

Enjoy your stay in our thriving community!

1 Like

When I right-click on my project area to create a State file, there is no State file about Folder in the drop down menu. I have looked all over the dropdown and cannot find a file named State to create… I am stuck here now.

4 Likes

Same problem here

Edit: I don’t know if its just a difference in Unity versions but when I pause ricks video, I can see that his assets folder shows up in the inspector. Mine does not.

I’ve double and triple checked the code, it’s identical. I am on a Mac. But yeah, there’s nothing I can do apparently at this point.

Edit #2: I seem to have fixed this though I am not 100% sure how I did it. My best guess is, I realized that I never finished adding “I am added programmatically” to the previous script, AdventureGame. I already knew how to add a text string, so I skipped along in that video to the end, and never finished the script, I had just left it as textComponent.text = ;

Perhaps the issue of not being able to compile this other script correctly was causing issues with the State script? I don’t know, but the second I went back and finished the previous script all of a sudden I could find the State option under create assets. The assets folder also showed up in the inspector.

1 Like

Zac, see above. Adding this comment to flag a new reply for you.

1 Like

Yep, that would do it - any errors or issues in one place are going to cause unpredictable issues elsewhere. Glad you got it nailed.

1 Like

I have this same problem. No problems in my script, but there are no options to select state from the menu. I do notice there are several assets present in your version that were not included in the previous version, the “State” script as well as the “Starting State” object.

I have same problem. I can’t create State.
And I can’t find required video(7_TX_CUD) where is it?
I wait your answer…

Ok I got some help on Discord (sooo useful)

there is a step missing. Create a new script and add this to it

[CreateAssetMenu(menuName = “State Machine/State”)]
public class State : ScriptableObject
{

}

2 Likes

Oh lol - If you keep watching he explains it.

I found it. Answer is in your lecture.
But when start lecture timing, I didn’t know that…
It show me next time.
Anyway thank you.

Hi all, am I understanding correctly that you are trying to replicate the thing I am doing in the first 10 seconds of the video? If so, sorry for the confusion, the first part of the video is explaining what we’ll be able to do by the end of the video, not what we can do at the start.

3 Likes

Hi all. My problem isn´t too important but I would still like to fix it. When i created the text file where I wrote the
challenge and I saved in visual studio into my assets file it looked different than in the video and also if i try to open the visual studio text file it wont let me. It only shows up when I open the state script.

It could be that you saved it as something other than a .txt file (text file). Normally we dont use Visual Studio to keep notes like this, so Visual Studio isn’t really expecting us save the file as a text file.

I had the same issue (no “State” option on the Create Asset sub-menu). I found this solution:

  • Right-Click in the Asset Area
  • Choose “Refresh” from the Asset Menu (command-R on my mac)

The option to create a “State” now appears on the Create sub-menu

I had to reboot my computer after installing Visual Studio 2017, in order to get the syntax highlighting and code hints to work. A friendly response from the Facebook group led me in this direction, but it would be nice to have a note in this video because this was the first one that I noticed it was an issue.

3 Likes

I have the exact same script, but it dosen’t show up. It cannot recognize CreateAssetMenu, giving me an error.

o:— Game Stuff\New folder\Assets\State.cs(2,2): Error CS0246: The type or namespace name ‘CreateAssetMenu’ could not be found (are you missing a using directive or an assembly reference?) (CS0246) (Assembly-CSharp)

Hi Wrys,

Could you post your script please?


See also;

1 Like

When we first got the error we just copy and pasted the script from this lecture. It’s exactly the same. If you still need me to send it I can, but it’s just the script at this point of the lecture.

Hi Wrys,

There shouldn’t be a problem with that script, it is, after all, working for many others. But let’s see if we can find out why it isn’t working for you.

If you zip up your project files and share them with me I will take a quick look and see if anything stands out.

The forum will allow uploads of up to 10MB, if your project files (zipped) are larger than that you would need to use a service such as Google Drive or Dropbox, and then share the URL.

1 Like

Alright then. I’ll work on getting that done when I get an opportunity.

1 Like

Privacy & Terms