Jump to content

fatcargo

Members
  • Posts

    393
  • Joined

  • Last visited

Posts posted by fatcargo

  1. Sorry to bother you again but i've failed after several variants.

    This is what i did as a starting point :

    1. create empty GameObject, rename to "test"

    2. create simple cube named "Cube"

    3. drag cube in game object as child

    2. create material (resides in "Materials" folder)

    3. assign "KSP/Diffuse" shader to material

    4. assign material to mesh renderer component of cube object, add PNG texture

    5. create "Prefabs" folder in asset explorer

    6. drag and drop "cube" object from inspector to "Prefabs" folder to create a prefab

    7. select prefab in asset explorer and select AssetBundle as "new" and type "cube"

    8. select from menu KSPAssets > Asset Compiler

    9. click on "Build" in "cube" row (make sure "auto" is selected)

    10. wait for build to complete and then copy "cube.ksp" into folder "ATestCube" inside "GameData" (size is about 0.5 MB, mostly because of texture)

    11. in same "ATestCube" folder create "cube.cfg" text file with
     

    PART
    
    {
    
    //...
    
    mesh = Cube
    
    //...
    
    }

    12. run KSP and it shows error,  says "PartCompiler: Cannot clone model from 'ATestCube' directory as model does not exist", though log file says that "cube.ksp" asset is loaded

    I also tried with MODEL{} to try and target my model by path

    PART
    {
      // ...
      MODEL
      {
        model = Prefabs/test
        position = 0.0, 0.0, 0.0
      }
      // ...
    }

    But it too failed with message "PartCompiler: Cannot clone model 'Prefabs/test' as model does not exist"

    So, how do i now reference my model in part config ?

     

  2. Thanks for the info. I will use this for models with complex animations.

    Though one thing still bugs me : what to do with cfg file ? It too needs to go into asset ? If i leave it in GameData, won't PartLoader try to load .mu model (which now resides in asset that i'll have to load later when my shader can be added to KSP), and then fail ? And if i have to load .cfg from asset, then MM won't be able to access it ?

    Does KerbalKonstructs do something like this ? I  looked inside sources for KK and made a small shader loader plugin that was supposed to load shaders prior to PartLoader start and it failed to do anything. To paraphrase linked forum post - the earliest time to load a shader is at MonoBehaviour.Awake() when LoadedScene is MainMenu.

    What also bugs me how come PartLoader doesn't fail on models containing KSP shaders ? If original KSP shaders are loaded later on, original models should also fail ?

  3. Ok thread restart.

    I was trying to analyze where i made a mistake but had no luck.

    @xEvilReeperx question about building assets : is the following link ...

    ... still a valid method ?

    I did found one interesting thing : "GameData\Squad\squadcorefx.ksp" is most likely place where shaders are stored, and models have no problem using those assets at loading time. Why is same not true for custom made .ksp assets ?

  4. In another attempt i removed completely animation from model with custom shader and it failed to load again. This time error it clearly showed in debug that unknown shader was used.

    Relevant lines from debug log:
     

    File error:
    Value cannot be null.
    Parameter name: shader
      at (wrapper managed-to-native) UnityEngine.Material.CreateWithShader(UnityEngine.Material,UnityEngine.Shader)
      at UnityEngine.Material..ctor (UnityEngine.Shader shader) [0x00009] in C:\buildslave\unity\build\Runtime\Export\Shaders\Shader.bindings.cs:118

     

    If i pursue this any further it may be needed to apply both shaders and animations at runtime. For the time being, this thread may be considered to be on pause.

  5. NB: i forgot to say that i want to scroll the mesh over texture's UV space, for a scrolling effect over surface. Maybe all this is not needed to accomplish what i want.

    The property animation is a text file and uses "attribute" and "path" human-readable strings to specify targeted property. It could be specific to mesh if "path" is directly referencing the mesh in model.

    I've tried making my own shader loader but it failed (as expected).  It was tagged as KSPAddon with instant startup. It appears to have successfully loaded the .ksp bundle, found the shader and loaded it into KSP, but the part using it still failed to load. Debug dump shows PartReader.ReadAnimation, so i'm sure it fails at animation.

    I've searched for info on custom shaders and seen that mostly they're loaded first, then applied to parts. Which is ok, but i have an animation referencing the shader, and i'd really like not to load that as well separately at runtime, and then apply custom shader. Looks like a lot of crutches propping up KSP API.

    IF TU can really load shaders before parts with property animations start being loaded and parsed, then i'd like to know more.

    Note that i did manage to create animation to drive shader property in unity editor. Below are contents of two files used to demostrate this.

    Here are two text blocks, save them in Unity project for testing in editor.

    For file "CUSTOMScrollingUnlit.shader" i keep in "Assets\Shaders" folder

    Shader "KSP/FX/CUSTOMScrollingUnlit"
    {
        Properties
        {
            _MainTex("MainTex (RGB Alpha(A))", 2D) = "white" {}
            _Color("Color (RGB Alpha(A))", Color) = (1, 1, 1, 1)
            [Space]
            _CoordinateU("_CoordinateU", Range(0, 1)) = 0
            _CoordinateV("_CoordinateV", Range(0, 1)) = 1
            [PerRendererData]_UnderwaterFogFactor("Underwater Fog Factor", Range(0, 1)) = 0
        }
        
        SubShader
        {
            Tags{ "Queue" = "Transparent" "IgnoreProjector" = "True" "RenderType" = "Transparent" }
    
            Pass
            {
                ZWrite On
                ColorMask 0
            }
    
            ZWrite On
            ZTest LEqual
            Blend SrcAlpha OneMinusSrcAlpha
    
            CGPROGRAM
    
            #include "../PartTools/LightingKSP.cginc"
            
            #pragma surface surf Unlit noforwardadd noshadow noambient novertexlights alpha:fade
            #pragma target 3.0
    
            sampler2D _MainTex;
    
            float _CoordinateU;
            float _CoordinateV;
    
            struct Input
            {
                float2 uv_MainTex;
                float3 worldPos;
            };
    
            void surf (Input IN, inout SurfaceOutput o)
            {
                fixed2 scrollUV = IN.uv_MainTex ;            
                fixed xScrollValue = _CoordinateU;
                fixed yScrollValue = _CoordinateV;
                scrollUV += fixed2(xScrollValue, yScrollValue);
                half4 c = tex2D(_MainTex, scrollUV);
                float3 normal = float3(0, 0, 1);
    
                float4 fog = UnderwaterFog(IN.worldPos, c.rgb * _Color.rgb);
    
                o.Albedo = fog.rgb;
                o.Normal = normal;
                o.Alpha = c.a * _Color.a * fog.a;
            }
            ENDCG
        }
    }

     

    For file "test.anim" i keep in "Assets" folder. It drives "_CoordinateU" and "_CoordinateV" properties to move texture across a surface.

     

    %YAML 1.1
    %TAG !u! tag:unity3d.com,2011:
    --- !u!74 &7400000
    AnimationClip:
      m_ObjectHideFlags: 0
      m_CorrespondingSourceObject: {fileID: 0}
      m_PrefabInstance: {fileID: 0}
      m_PrefabAsset: {fileID: 0}
      m_Name: test
      serializedVersion: 6
      m_Legacy: 1
      m_Compressed: 0
      m_UseHighQualityCurve: 1
      m_RotationCurves: []
      m_CompressedRotationCurves: []
      m_EulerCurves: []
      m_PositionCurves: []
      m_ScaleCurves: []
      m_FloatCurves:
      - curve:
          serializedVersion: 2
          m_Curve:
          - serializedVersion: 3
            time: 0
            value: 0
            inSlope: 0
            outSlope: 0
            tangentMode: 136
            weightedMode: 0
            inWeight: 0.33333334
            outWeight: 0.33333334
          - serializedVersion: 3
            time: 1
            value: 1
            inSlope: 0
            outSlope: 0
            tangentMode: 136
            weightedMode: 0
            inWeight: 0.33333334
            outWeight: 0.33333334
          m_PreInfinity: 2
          m_PostInfinity: 2
          m_RotationOrder: 4
        attribute: material._CoordinateU
        path:
        classID: 23
        script: {fileID: 0}
      - curve:
          serializedVersion: 2
          m_Curve:
          - serializedVersion: 3
            time: 0
            value: 0.9
            inSlope: 0
            outSlope: 0
            tangentMode: 136
            weightedMode: 0
            inWeight: 0.33333334
            outWeight: 0.33333334
          - serializedVersion: 3
            time: 1
            value: 0.2
            inSlope: 0
            outSlope: 0
            tangentMode: 136
            weightedMode: 0
            inWeight: 0.33333334
            outWeight: 0.33333334
          m_PreInfinity: 2
          m_PostInfinity: 2
          m_RotationOrder: 4
        attribute: material._CoordinateV
        path:
        classID: 23
        script: {fileID: 0}
      m_PPtrCurves: []
      m_SampleRate: 60
      m_WrapMode: 0
      m_Bounds:
        m_Center: {x: 0, y: 0, z: 0}
        m_Extent: {x: 0, y: 0, z: 0}
      m_ClipBindingConstant:
        genericBindings: []
        pptrCurveMapping: []
      m_AnimationClipSettings:
        serializedVersion: 2
        m_AdditiveReferencePoseClip: {fileID: 0}
        m_AdditiveReferencePoseTime: 0
        m_StartTime: 0
        m_StopTime: 1
        m_OrientationOffsetY: 0
        m_Level: 0
        m_CycleOffset: 0
        m_HasAdditiveReferencePose: 0
        m_LoopTime: 1
        m_LoopBlend: 0
        m_LoopBlendOrientation: 0
        m_LoopBlendPositionY: 0
        m_LoopBlendPositionXZ: 0
        m_KeepOriginalOrientation: 0
        m_KeepOriginalPositionY: 1
        m_KeepOriginalPositionXZ: 0
        m_HeightFromFeet: 0
        m_Mirror: 0
      m_EditorCurves:
      - curve:
          serializedVersion: 2
          m_Curve:
          - serializedVersion: 3
            time: 0
            value: 0
            inSlope: 0
            outSlope: 0
            tangentMode: 136
            weightedMode: 0
            inWeight: 0.33333334
            outWeight: 0.33333334
          - serializedVersion: 3
            time: 1
            value: 1
            inSlope: 0
            outSlope: 0
            tangentMode: 136
            weightedMode: 0
            inWeight: 0.33333334
            outWeight: 0.33333334
          m_PreInfinity: 2
          m_PostInfinity: 2
          m_RotationOrder: 4
        attribute: material._CoordinateU
        path:
        classID: 23
        script: {fileID: 0}
      - curve:
          serializedVersion: 2
          m_Curve:
          - serializedVersion: 3
            time: 0
            value: 0.9
            inSlope: 0
            outSlope: 0
            tangentMode: 136
            weightedMode: 0
            inWeight: 0.33333334
            outWeight: 0.33333334
          - serializedVersion: 3
            time: 1
            value: 0.2
            inSlope: 0
            outSlope: 0
            tangentMode: 136
            weightedMode: 0
            inWeight: 0.33333334
            outWeight: 0.33333334
          m_PreInfinity: 2
          m_PostInfinity: 2
          m_RotationOrder: 4
        attribute: material._CoordinateV
        path:
        classID: 23
        script: {fileID: 0}
      m_EulerEditorCurves: []
      m_HasGenericRootTransform: 0
      m_HasMotionFloatCurves: 0
      m_Events: [] 

    I added "test.anim" to list of animations in Animation component, which is located inside mesh object whose texture i want to animate.

  6. I've found that making a shader, then creating a ksp asset bundle and then copying it somewhere into GameData won't work,  mu. model using that shader still won't load.

    I've looked around for sources on loading custom shaders and i can put something together.

    What i'm not sure is if a .mu file contains an animation that drives a property inside this custom shader the part will still fail to load if shader is not beforehand loaded/registered into KSP.

    If the above is true, do i need to write a plugin that loads BEFORE parts start to get loaded ? Like ModuleManager does for example.

    @Shadowmage Please enlighten me on this. Thanks in advance.

     

  7. I had a problem with breakpoints not being hit while debugging code. On a line with breakpoint i had a yellow circle with an exclamation mark and a popup text saying "The breakpoint will not currently be hit. Unable to find a corresponding location.".

    After some struggle i found a solution at https://stackoverflow.com/a/46720817. Basically i did the same but instead using Net 2.0 i switched from original 4.5 to 4.0 and back to 4.5. Each time VS informed to re-save the project. After that i followed instructions with a clean and rebuild and it worked. My breakpoints work again. It may be worth mentioning i had OS and VS on a SSD while project files and game itself are on another HDD. It appears that VS is not properly flushing cached files, causing .pdb to be out of sync with plugin .dll. It also explains why new project had no problems and as time went on it started to misbehave. Cycling between 4.0 and 4.5 may be an overkill but i mention it just in case.

  8. Ohh that's perfect ! That means i can add emissive, not worry about (too much) overhead and it will work in dark ! Yay ! Oh and update : i removed source anims, compiled anim works completely alone but i'm also curious about a possibility of adding curves for animating properties with arbitrarily set animation keys, even if animation with imported mesh does not have reserved time slots for it.

    Here is a post that hints at this,

     

     

  9. THANKS FOR THE PIC ! IT WORKED ! That small thing ... so much difference. And now i can use ModuleAnimateGeneric, no need for exotic stuff (yet :) ).

    I have to note that info is scattered across several threads but here is what i found :

    This is useful reference to see how parts are constructed, i used "light" demo to confirm my Unity install worked properly,

     

    "Central" reference with information (there may be smaller bits of info one can miss if tired/distracted),

    In my case, my mesh was imported as FBX file with Animation component, added to GameObject that holds PartTools.

    I've added a plain KSP/UnlitColor material to small piece of mesh to be used as color indicator (which is child of other meshes in animation).

    Then i created a new property animation (i guess this is appropriate name for it) and in "Reference" field wrote path to my color indicator mesh as first_level_child_of_imported_file/child_level_1/color_indicator_mesh. You can see this in yt video posted in Color Animation Editor thread when demonstrating Reference setup to "HierarchyEmissive" part of video. Pay attention at what is going on when watching it, it is easy to miss crucial details as design process is quite quick.

    This animation is targeting property "_Color" (note the leading underscore) found in KSP/UnlitColor material assigned to color_indicator_mesh.

    Then i selected my color_indicator_mesh in scene tab and opened Animation tab (menu Window > Animation or CTRL+6) and edited keys as needed.

    Next step was to, inside Project tab, CTRL+click multi-select both animation imported along with FBX and a newly created property animation, then right-click on any of selected items and from menu choose Animation > Compile Selected.

    This creates a new animation named "CompiledAnimation" in same folder as source animations. Don't forget to set "Legacy" flag as noted in previous post.

    Now i added that to a list of animations to root item where original imported animation resides. So there were three animations, original, property and freshly compiled one in animation array (i also added property animation).

    Finally, i did the usual exporting step and copied to GameData.

    After that i added CompiledAnimation to ModuleAnimateGeneric in animationName field, tested and that was it. It worked :)

    More useful bits of info to ones learning : while i was trying to make it work, i had two types of failures : part compiler failed to compile part and subsequently model was not found. Not much to do here except try again.This error is visible during load. Second failure type was far more dangerous - it made my KSP game eat up nearly all of my RAM, it used up 6.5GB in middle of load. For several times i barely managed to end task before it turned my machine into crawling pile of mud. :) One more thing : do not be alarmed when editing keys in property animation and see property names in yellow coilor with "(Missing!)" text,  it works and it can be tested by dragging animation cursor.

    I'll try emissives next, they need extra step for creating textures. Which brings me to my next question : @JadeOfMaar some long time ago i've read on forums about limits for number of lights in scene. Does this apply to emissives as well ? I wouldn't want to burden player's machines with even more ultra-deluxe bang-whizz-splash :)

     

  10. I've managed to create a test part that includes both standard mesh animation and color animation, driving Color property of KSP/UnlitColor material on one of animated parts.

    I can execute mesh animation with ModuleAnimateGeneric, but i don't know how to also start Color animation at the same time. Is there an extra parameter that ModuleAnimateGeneric can parse ?

    Or, is there a custom plugin that can run two animations at the same time ?

  11. @blowfish

    I have created a single part to expand upon available HX pack, not yet released. It is created using assets from B9 Aerospace HX.

    There will be more parts to make this expansion a complete package, i just need to clear it first with you.

    I'd like to also release FBX files used to create parts, in separate or single package.  FYI, i also used and changed textures to fit my parts (pitty i could not use original textures for my geometry).

    Also, the first of HX parts i created requires my custom animation plugin to work properly.

    For now, my focus is on releasing and showcasing my plugin in separate thread, but since it uses part derived from B9 Aerospace HX package, i ask for permission to use it in my to-be-created WIP plugin release thread.

    I'm collecting permissions, license info, github how-to and other info to get ready for first release.

  12. Thanks for the idea ! It made my code simpler since i needed to add event in my partmodule, then initialize listener for every event, customize its variables and then call my player function from those listeners.

    Now i have just one listener and one player. Also, i kept the string var to pass needed arguments via stringParameter. Though it still needs a single call to myAnimation.gameObject.AddComponent<MyListener>() to work.

  13. Thanks for reply ! I did just that (and by sheer luck i googled the answer after thinking WHERE i could set these custom paramaters). I've set a several custom variables inside a listener, which get converted/packed into string and then event handler "unpacks" the string and gets data. Lucky for me, event handler lives inside my class so all i had to send is a few ints used as indexes used with my lists/arrays.

    What i did was to add, for each animation event, a listener via AddComponent() with customized parameters. All listeners then send a customized message to same single event handler inside my original class. What i became aware of later, is that i was also very very lucky that for each call to AddComponent(), a new instance of listener is created and all parameters are nicely separated. If it were static and all subsequent calls to AddComponent() either failed or have overwritten previous listener, this whole thing would not be possible.

  14. While making my animation plugin i started my last (pre-release) phase of adding sound support (Configuration, Animation, Control, Utility and Visual are done)

    I want to add sound fx to my animation(s) but my currently employed method of control/tracking animations properties can be a hit-and-miss for sound support

    (controlling animations looks fine for now).

    It works via PartModule.Update() and PartModule.OnUpdate(). These are not directly visible in PartModule (ie not suggested by VS IDE), but can be used

    because it inherits from Monobehaviour.

    After successfully doing some basic audio tests, i wanted to write an event handler that receives a reference to my class holding all needed data. And this is where i hit a wall.

    AnimationEvent handler is not designed to receive data in arbitrary form.

    There is objectReferenceParameter, but i don't know how to reference my class this way, it expects UnityEngine.Object.

    If example is needed, i'll try to provide a short version.

     

    Reference material

     

     

  15. Ok here it goes. The following code should be self-contained so copy/paste into IDE  would work out of the box.

    It is derived from my code which is a mess and posting it directly would not be helpful. I had to make a separate block of code in editor just to make sure no errors creep in.

    This is demonstration of how to maintain top/left position of window while it changes size. No reset to coordinates given at SpawnPopupDialog(), no flickering during position update.

            public Vector3 popupOldPosition = Vector3.zero;
            public Vector2 popupOldSize = Vector2.zero;
            public Vector3 popupCorrectedPosition = Vector3.zero;
            public bool popupIsDragging = false;
            public bool doRefresh = false;
            public PopupDialog myDialog = null;
            public bool showDescription = false;
    
            public void ShowDialog()
            {
                myDialog = PopupDialog.SpawnPopupDialog(
                    new MultiOptionDialog(
                        "visible title text", "", "",
                        HighLogic.UISkin,
                        new Rect(0.5f, 0.5f, 300f, 300f),
                        new DialogGUIVerticalLayout(
                            new DialogGUIButton("Close", () => { }, true),
                            new DialogGUIToggleButton(false, "show/hide", (b) => { showDescription = b; RecordOldPos(); }, 100f, 15f),
                            new DialogGUILabel("long text that needs to fit inside available width of window so it has to break on multiple lines", 100f, -1f)
                            {
                                OptionEnabledCondition = () => { return showDescription; }
                            }
                        )
                    ), false, HighLogic.UISkin, false);
    
                myDialog.dialogToDisplay.OnResize = () =>
                {
                    if (!popupIsDragging && myDialog != null && doRefresh)
                    {
                        doRefresh = false;
                        RestoreOldPos();
                    }
                };
    
                EventTrigger popupDialogEvent = myDialog.gameObject.AddOrGetComponent<EventTrigger>();
    
                EventTrigger.Entry popupBeginDrag = new EventTrigger.Entry() { eventID = EventTriggerType.BeginDrag };
                popupBeginDrag.callback.AddListener((e) => { popupIsDragging = true; });
                popupDialogEvent.triggers.Add(popupBeginDrag);
    
                EventTrigger.Entry popupEndDrag = new EventTrigger.Entry() { eventID = EventTriggerType.EndDrag };
                popupEndDrag.callback.AddListener((e) =>
                {
                    popupIsDragging = false;
                    RecordOldPos();
                });
                popupDialogEvent.triggers.Add(popupEndDrag);
            }
    
            public void RecordOldPos()
            {
                if (myDialog != null)
                {
                    popupOldPosition = myDialog.RTrf.position;
                    popupOldSize = myDialog.RTrf.rect.size;
                }
                doRefresh = true;
            }
    
            public void RestoreOldPos()
            {
                if (myDialog != null)
                {
                    popupCorrectedPosition.x = popupOldPosition.x + (popupOldSize.x - myDialog.RTrf.rect.size.x) / 2;
                    popupCorrectedPosition.y = popupOldPosition.y + (popupOldSize.y - myDialog.RTrf.rect.size.y) / 2;
                    popupCorrectedPosition.z = popupOldPosition.z;
                    myDialog.RTrf.position = popupCorrectedPosition;
                }
            }

     

    Note the use of custom added events to properly capture window position. Until i understood the coordinate system used for positioning and size of window i couldn't make heads or tails from available positional data.

    I'll add comments to code here instead of code box to keep it clean.

    "showDescription" is used to set visibility of label via toogle button.

    "popupIsDragging" is used for checking if dragging has ended (BeginDrag event is needed just to reinitializeset this variable. In this case it may appear superfluous, but may be necessary for more complex code that may update window contents during dragging operation).

    "popupOldPosition" , "popupOldSize" and "popupCorrectedPosition" are used to capture old and calculate new coordinates to maintain visually position of window while it's contents change.

    Now for the DRAWBACKS.

    The RecordOldPos() function HAS to be manually inserted into callback for any UI element that may cause window resizing event. I have not found any callback that fires just before window resize event, if there was one, it would capture all changes in one neat function.

    In above example a toggle button calls RecordOldPos() inside its onToggled() callback event.

    Note that myDialog.dialogToDisplay.OnResize() callback first sets "doRefresh" to false then calls RestoreOldPos(). Ordering is important because it may trigger another OnResize() event. During initial testing i haven't added this check and managed to crash KSP by causing self-triggering.

    The coordinate system used for positioning is centered inside display area, so setting window at (0,0) will put in middle. Also, a window transform is also put in center of window itself, not on any of corners.

    ASCII art time :) Deptiction of center coordinates on "screen space". X and Y are positive going right and upward. Negative coordinates move to left and below of screen's center.

                        /|\ Y+

                          |

    ____________|___________

    |                    |                     |

    |                    |                     |

    |                (0,0) ------------- |-------------> X+

    |                                         |

    |                                         |

    |______________________|

    Similar is with popup window's transform. It is also located at center of window and has same orientation.

    Now, a few words of caution. While i tested my code, i managed to get window completely outside visible area.

    It seems that authors intentionally added coordinate origin to center of screen, so if plugin sets window XY position to 0, it won't disappear. Also, whenever window is resized, its vital UI elements may end up outside visible area (for some rare cases for gigantic-sized windows) so it tries to reset to center, maximizing utility and minimizing loss of control. Bear in mind that modal windows will block user input and if they "fly" outside available screen space... Well, you get the picture :)

  16. HA! I managed to make it clean, no more stutter when doing visibility toggle on UI element ! I'll post an example tomorrow, but for now a hint : use yourDialog.dialogToDisplay.OnResize() callback to set position with yourDialog.RTrf.position Vector3 variable.

    It will nicely reposition the window BEFORE it gets rendered. Oh, i also added a bool refresh flag which is set to true at point where visibility toggle runs and then clear it in OnResize(). That way, callback won't cause runaway self-triggering (hmm i'll try without that refresh flag to see if it indeed self-triggers).

    The only thing left (avoidable) is when hide/show happens, the whole window changes size, so top/left position still  jumps. I'll try to cook up some math to compensate for it.

  17. Yes it is pretty much same issue - i switch visibility of label via toggle button and window gets reset to positions defined at spawn.

    I did manage to set it back to last position prior to switching visibility, but you can still see for a brief moment how it jumps to old position then moves back.

    I will do more tests to see if i can hide that visual "stutter".

  18. I've made a window that has a label with multiline text and a toggle button that controls label's visibility of that label (via OptionEnabledCondition).

    EXAMPLE SNIPPET
     

    public bool showDescription = false;
    public DialogGUILabel lab = new DialogGUILabel("example text for\nmultiple\nlines") { OptionEnabledCondition = () => { return showDescription; } };
    public DialogGUIToggleButton toggle = new DialogGUIToggleButton(false, "show/hide", (b) => { showDescription = b; }, 100f, 20f);

    When toggling label visibility, my popup window changes size as it should, but it also resets back to screen coordinates set at SpawnPopupDialog().

    Can this be prevented ? I can manage repositioning the window to original coordinates, but is is way too visible and kind of ugly. For anyone interested, i used same EventTrigger() / AddListener() trick as with my jog-shuttle slider.

    Oh, and does anyone know how to stop ESC from closing the popup window ? I assume it can be done by intercepting ESC keypress event game-wide, though i'd like to target event stream just for my popup window.

×
×
  • Create New...