I don’t know why it does not change. exact same code as this lessons(151 lesson number).
update - i think from another post it was mentioned when the isPlaceable bool stated in an awake method, it works fine. This is indeed the case. My project runs fine now. It’s just odd how the code from the video doesnt work ‘for me’ but for Ben it appears to work fine. Without needing to use the Awake function. If anyone can shed light on this that be great.
Which version of Unity do you use? What do you mean by “isPlaceable” remains unticked? Do you try to tick it in the Inspector but Unity does not react?
Also make sure that you are looking at the Inspector of a game object in your Hierarchy, not at the Inspector of a prefab in your Assets folder.
Im using 2017.4.36f1 as I saw this project was being made with the 2017 version.
When I run the game isPlaceable is supposed to be unticked or ticked depending on the block you click on. But for me all indicated as being unticked.
I click on the blocks in the game to, not the prefab. What I would like to know is why doies it work when I place it in the Awake() but not when it is in global scope? I mean, this is the only way I got it to work (someone gave me this idea in the forums). Ben had his working how he wrote his code. Just did not seem to work for me though. Unless I placed the bool variable in the Awake(). Odd isn’t it. If you would be able to give any thoughts on this, thank you.
If the bool does not get set to true, I would check if there is a misplaced semicolon somewhere or a wrong condition. And I would write a bunch of Debug.Logs to narrow the problem down.
Have you already compared your code to the Lecture Project Changes which can be found in the Resources of this lecture?
If you found a solution, use it. In many cases, there are multiple ways to make something work in Unity. You are not oblieged to use Ben’s.
Thank you Nina. I appreciate you getting back to me regarding the post I made.
Yep, I have found a solution so that’s the main thing I guess. I did compare the code to Ben’s looking at the github repository also. Just seems to be something amiss for me.
It is a shame I can’t run breakpoints for this project as ‘attached to unity’ does not appear in my VS. I think it is because i’m running Visual Studio 2019 with Unity 2017 project. I tried Unity 2019 with VS’19 and the attached to Unity button shows. So for this project, I cant run breakpoints to so can’t see why the bool isn’t changing where in my code to.
Your debug idea is a good one though. Overall, i’m pressing on with the course as I am aiming to have it done within a week now. So I can start on some of my own ideas ;). Liking this course immensely. Such a good subject to touch on this RealmRush, AI etc. Really looking forward to the first person shooter that is up next. Thanks for your help again.
Is Visual Studio selected as your External Script Editor in Unity (Edit > Preferences > External Tools)?
VS 2019 seems to have some issues with Unity. I use VS 2017. Debugging with breakpoints works there.
Yes, Visual Studio 2019 seems to be setup within preferences, external editor.
Oh ok, so VS 2017 works you say. Can I ask, is there any issue I should concern myself with if I was to install VS’17 when I have VS’19 already on my system?
I thought I heard something about if you have a newer Visual Studio, when you get an older version it can cause some issue. Maybe I heard wrong though. Have you heard anything like this at all?
VS 2019 is fine but there have been some issues with Unity in the past. I haven’t installed it yet because VS 2017 works for me. VS does not have anything to do with Unity, so using VS 2017 will not affect any of your Unity projects.
Are the Unity development tools installed in VS 2019 (Tools > Extensions and Updates)? If they are not installed, go to Tools > Get Tools and Features.
This topic was automatically closed after 14 days. New replies are no longer allowed.