Search Unity

CSGO Bullet Spray Editor

Discussion in 'Scripting' started by ZhavShaw, Jan 3, 2019.

  1. ZhavShaw

    ZhavShaw

    Joined:
    Aug 12, 2013
    Posts:
    173
    Hi, I'm looking for ideas on how to approach creating an editor sort of like the one for CSGO Bullet Spray.


    The idea I had was to just not touch the array editor, and display all of the positions on some sort of canvas below. Then change the color of the dots with lerp based on their position in the array. I'm just not sure how I would create such a canvas and display the dots.
     
    Last edited: Jan 3, 2019
  2. ZhavShaw

    ZhavShaw

    Joined:
    Aug 12, 2013
    Posts:
    173
  3. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,692
    I like that guys solution because it uses the preview GUI pane, something I've not tinkered with.

    Meanwhile I made my own that is click-to-place, but it takes a different approach: there is presently no underlying data container, but you could easily plumb in a ScriptableObject type container that has your Vector2 list. Instead, the list in mine is just stored in the editor window object transiently.

    After you import the package below, you MAY need to re-drag the two PNG files onto the script itself (NOT an instance of the script obviously). See the comment near the Texture2D references.

    Left click to add dots, right click to remove. I'm glad you asked the question because now I worked through it and know all the fiddly bits of EditorWindows a bit better!

    For reasons of laziness mine is called SimpleDrawing. :) All the code is in the .unitypackage and here's a screencap:

    Screen Shot 2019-01-03 at 2.58.37 PM.png
     

    Attached Files:

    Last edited: Jan 3, 2019
    SparrowGS and ZhavShaw like this.
  4. ZhavShaw

    ZhavShaw

    Joined:
    Aug 12, 2013
    Posts:
    173
    Awesome approach! Yeah, it's already annoying messing with 30+ Vector2 values in an array haha.
     
  5. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,692
    I imagine you could mash up a combination of his code and my code and end up with juuuuust what you need.

    I love the Unity Editor. So powerful. "There's an editor window for that..."
     
  6. ZhavShaw

    ZhavShaw

    Joined:
    Aug 12, 2013
    Posts:
    173
    I was thinking of doing exactly that. Using your code to generate an array into a file or scriptable object variable, then using the other guy's script to visualize the array in the editor. But before I do that:
    https://gyazo.com/07dc57634127d976283bf9ed6b36a601

    I'll have to reverse the script and repost so others can use too.
     
  7. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,692
    Nice. Another thing I thought about was to drag and place discrete bullets at different parts, then you could go back and edit them... that's the freakin' problem with editors: "Oh if I just add this one more thing..."

    Have fun man! Looks like you're cookin' with gas now...
     
    ZhavShaw likes this.
  8. ZyWHO

    ZyWHO

    Joined:
    Feb 9, 2021
    Posts:
    1
    As for me, this is not very necessary for players, because they just remember the spread of bullets, and everything is stored in the muscle memory. I believe this can only help novice players who don't know the bullet spread. I have 10 lvl faceit now, and I laugh when I remember how I thought that if I had at least the Cheapest csgo knife , I would play better, ahahahhah. I have already won 4 lan tournaments and several fastcaps. It's fun when the game is interesting for you, and you can also earn money from it. I am engaged in trading and every week I race with new skins, and then sell more expensive.
     
    Last edited: Feb 17, 2021