Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Spot Generator resetting some values after Script compilation
#1
Hello 

I am creating spot generator using editor script and every thing is working super fine , but after I change some code and wait for compilation to finish the values resetting it self. 
To be more accurate the values that are resetting are in translation and rotation in BuildVolumeSpots module. here is code how i change them

Code:
volumeSpot.Groups[0].TranslationX = new FloatRegion(0,0);
volumeSpot.Groups[0].TranslationY = new FloatRegion(0,0);
volumeSpot.Groups[0].TranslationZ = new FloatRegion(0,-4);
volumeSpot.Groups[0].RotationX = new FloatRegion(0,0);
volumeSpot.Groups[0].RotationY = new FloatRegion(0,90);
volumeSpot.Groups[0].RotationZ = new FloatRegion(0,0);

I tried set dirt as as group, and i did single one and tested it but it always resetting values after compilation.

volumeSpot.Dirty = true;
EditorUtility.SetDirty(volumeSpot);
EditorUtility.SetDirty(environmentGenerator);//Generator that contains volumeSpot

I added bellow image of Debug Inspector on one of volume spot module 

I am using Oadin inspector and i function that create the generator is on MonoBehaviour script  using button to run it . Every thing is working perfect when I create the generator until code compilation then values get reset.


Attached Files Image(s)
   
Reply
#2
Hi,
I can't think of any obvious cause for this right now. I am not close to my computer right now, but I will take a look at this on Monday. Will keep you updated.
Happy Aid Al Fitr
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#3
Thanks for reply , and happy Eid to you too  Big Grin
Reply
#4
Hi
I couldn't reproduce your issue. I attached a scene and a script that I used to try to reproduce the issue. The "Tester" game object has a "MosDefSpots" script with an "ApplyModification" boolean. Each time the boolean is turned to true, the modifications are applied and the bool is set to false in the same frame. After recompiling the applied modifications do not disapear. If you don't see anything missing in my reproduction case, please send me one you made.
Have a nice day


Attached Files
.zip   MosDefSpots.zip (Size: 6.97 KB / Downloads: 1)
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#5
Thanks for replay , I have tried the solution you provided. But unfortunately it still the same .

I also tried to use async function to make delay before refreshing the generator , but it is also the same generator keep resetting its values.

However I think I narrow it down a little , I noticed the values resetting is not directly related to script compilation because when I open the graph window for the generator it self and directly change the values for translation for example , it will reset all values for translation and rotation back to zero.

here is image bellow of how my spot looks like, if I changed the translation z for ex. it will reset all translation and rotation values back to zero , and keeps all other values as is ( like space before and after)


Attached Files Image(s)
   
Reply
#6
Sorry but I still can't reproduce your issue. Maybe you have some script that triggers when the module is refreshed and that overrides the values? If not, the only way I see to move forward is to provide me with a reproduction case. Please keep in mind that this forum is public in case you will post links to download some private work on it.
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#7
Hello , I make a separate scene to show you how its resetting values

I attached unity package contains a scene with the reset case occur. If you select game object called spot creator , you will find button to create the spot groups on spline however after creating that spot generator if you tried to save the scene and open it again it will reset the values , Or if you tried to change one of translation values it will reset all other values. please let me know if you need more details. Thanks.

here is the link for unity package

https://we.tl/t-byFf8VQ6hW
Reply
#8
Hi
I get the following compiler error:
Assets\GenratorResetTest\SpotGeneratortTest.cs(49,29): error CS1061: 'InputGameObject' does not contain a definition for 'InitGameObjectList' and no accessible extension method 'InitGameObjectList' accepting a first argument of type 'InputGameObject' could be found (are you missing a using directive or an assembly reference?)
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#9
Terribly sorry for That , I modified InputGameObject.cs script in Plugins/Curvy/Base/CG Modules by adding that function directly to that script and forgot to send it.

This is the function I added 

Code:
 
public void InitGameObjectList(List<CGGameObjectProperties> lstObjects)
        {
            GameObjects.Clear();
            GameObjects.AddRange(lstObjects);
        }

I added that script to attachment you can replace it with the script in plugin folder. I imported the package i sent to you into empty project and then got this error and it was fixed when I replaced the script.

I really appreciate your valuable support and your time, sorry for this silly mistake from my side .


Attached Files
.cs   InputGameObject.cs (Size: 2.89 KB / Downloads: 2)
Reply
#10
Hi

Found the bug. Will write a longer answer tomorrow, but to give you a a quick solution until then:
Add this constructor to the BuildVolumeSpots class
BuildVolumeSpots()
{
Version = "1";
}

Have a nice day
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Manipulate Generator properties in c#? blabz2007 9 159 06-18-2021, 09:17 AM
Last Post: _Aka_
  Accessing generator's input spline in script, changing it at runtime smackledorf 3 116 06-17-2021, 01:59 PM
Last Post: _Aka_
  Questions about Generator: mesh/objects within spline, snap to control point dartboard 5 201 06-09-2021, 12:42 PM
Last Post: _Aka_
  Compilation issues for iOS with a scene containing generators puzzlekings 2 250 05-13-2021, 06:53 PM
Last Post: _Aka_

Forum Jump: