Closed yonoslaw closed 5 years ago
Have you ticked "auto listen" under the event, or set unityEventEnabled = true from code?
Yes I did. Maybe this have something to do with the scene being loaded. I have two scenes A and B. The reference is on scene B.
If I press play on scene B the it works. If I press play on scene A that loads scene B the it does not work.
Interesting. This could be to do with Unity's difficulties serialising references to objects across scenes. It would be really helpful if you could send me a repro project - would that be possible?
Sorry that I didn't respond earlier.
I will prepare a repro for you this week.
Thanks :)
The repro is not exactly what I was talking about earlier. I was preparing it but had similar issues even on one scene. Now I don't know if it is an error or it is just me and I don't understand how it suppose to work.
A simple scene with Script1 that writes to a variable and Script2 that has a variable reader. You must press a mouse button to make the Script1 change the value.
Now Script2 has two methods. 'ShowVariable1' that is connected via the 'OnUpdate' in GameObject [Script2] and 'ShowVariable2' that is connected by the code in 'OnEnable' of Script2.
Now when in Play Mode the variable reader says "DISABLED" and when the variable gets updated only 'ShowVariable2' triggers.
Setting Auto Listen on [Scritp2] make an error when run.
NullReferenceException: Object reference not set to an instance of an object SmartData.Components.SmartRefUnbinder.OnEditorChangePlayMode (PlayModeStateChange change) (at Assets/SmartData-master/Utilities/SmartRefUnbinder.cs:40) UnityEditor.EditorApplication.Internal_PlayModeStateChanged (PlayModeStateChange state) (at C:/buildslave/unity/build/Editor/Mono/EditorApplication.cs:293) UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
Project link. https://www.dropbox.com/s/jkcjzagrwg77d1w/SmartDataRepro.zip?dl=0
Thanks for the repro. I've figured out what's going wrong - it's basically a typo in some reflection code, but I'll need to change a couple of other things around it too. Should have a fix pushed soon.
Apologies for not sorting this yet - we've been very busy on multiple projects and haven't had time to focus on the repo. These projects do involve SmartData and there's a lot being done internally, but it'll probably all come as a couple of large-ish updates in a while.
Apologies again for the delay, but this is now fixed on master and dev, along with a few other things. I'm planning to also make a new .unitypackage release shortly.
I don't get it! I have a reference to a smart set of a custom type in my script. When I run it a red "DISABLED" appears under the events and the smart set does not receive any events. What am I doing wrong?